What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Universal configuration monitoring and system of record for IT.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags



Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

Commands tagged svn from sorted by
Terminal - Commands tagged svn - 94 results
svn log | perl -pe 's/\n//g => s/^-.*/\n/g'
2011-10-20 01:20:52
User: dbr
Functions: perl
Tags: svn perl svn log

dirrrty: use -p to chomp automatically, substitute all newlines away and then replace the "---" by a newline ? bingo!

s/// => s/// is just a cooler way to write s///, s/// which is just the small brother of s///; s/// (comma is an operator!)

have fun!

svn log | perl -l40pe 's/^-+/\n/'
2011-10-14 16:02:22
User: bazzargh
Functions: perl
Tags: svn perl svn log

the output of svn log is annoying to grep, since it spreads the useful info over multiple lines. This compacts the output down to one line so eg you can grep for a comment and see the rev, date & committer straight away.

Updated: MUCH shorter, easier to remember. Now it just replaces newlines with spaces, except on '---' lines.

svn status|grep -iR '^!'|sed 's/!/ /g'|xargs -i svn rm '{}'
2011-10-06 08:11:25
User: erdeszt
Functions: grep rm sed xargs
Tags: svn sed xargs grep

Helps if you accidentally deleted files from an svn repo with plain rm and you would like to mark them for svn to delete too.

chflags -R nouchg ./
2011-08-17 08:39:16
User: matths

otherwise you get this error message:

svn: Can't move '.svn/tmp/entries' to '.svn/entries': Operation not permitted

svn st | grep '^?' | sed -e 's/\?[[:space:]]*//' | tr '\n' '\0' | xargs -0 svn add
lynx -dump -nolist http://whatthecommit.com/|sed -n 2p
2011-04-17 17:45:18
User: houghi
Functions: sed

Fetch comical VC commit messages from whatthecommit.com

curl -s http://whatthecommit.com | html2text | sed '$d'
2011-04-14 16:51:53
User: zbeekman
Functions: sed

Requires html2text. Print bad, but often funny commit messages from whatthecommit.com

svn ci -m "$(curl -s http://whatthecommit.com | sed -n '/<p>/,/<\/p>/p' | sed '$d' | sed 's/<p>//')"
2011-04-14 15:05:14
User: zbeekman


curl -s http://whatthecommit.com | sed -n '/<p>/,/<\/p>/p' | sed '$d' | sed 's/<p>//'
svn diff -r 1792:HEAD --summarize | awk '{if ($1 != "D") print $2}'| xargs -I {} tar rf incremental_release.tar {}
2011-04-05 15:00:49
User: windfold
Functions: awk diff tar xargs
Tags: bash svn awk xargs tar

The result of this command is a tar with all files that have been modified/added since revision 1792 until HEAD. This command is super useful for incremental releases.

svn up -rREV file
svn diff -r M:N file.php | patch -p0
2011-03-29 04:15:02
User: ruslan
Functions: diff patch

M - current revision, N - older revision

for R in `svn log file:///path/repo | grep ^r | grep dude | cut -d' ' -f1 | cut -dr -f2`; do svn ps svn:log --revprop -r $R "`svn pg svn:log --revprop -r $R file:///path/repo; perl -e 'print ".\n";' | fromdos`" file:///path/repo; done
2011-03-24 08:29:15
User: theist
Functions: cut grep ps
Tags: svn

Let's supose some moron used some m$ shit to commit to a later svnsynced repo. On a svn sync all his message logs cause a svnsync: Error setting property 'log': this commands finds all its contributions and fix all his commit logs

svn st | awk ' {if ( $1 == "?" ){print $1="",$0}} ' | sed -e 's/^[ \t]*//' | sed 's/ /\\ /g' | xargs svn add
2011-02-09 14:02:54
Functions: awk sed xargs
Tags: svn

This should handle whitespaces well and will not get confused if your filenames have "?" in them

xdg-open $(svn info | sed -n '/URL:/s/URL: //p')
svn log -q | grep '^r[0-9]' | cut -f2 -d "|" | sort | uniq -c | sort -nr
2011-01-03 15:23:08
User: kkapron
Functions: cut grep sort uniq

list top committers (and number of their commits) of svn repository.

in this example it counts revisions of current directory.

svn status | grep '^?' | sed -e 's/^? */svn add "/g' -e 's/$/"/g'|sh ; svn status | grep '^!' | sed -e 's/^! */svn delete "/g' -e 's/$/"/g'|sh
svn log -q | grep -v "^-" | cut -d "|" -f 2 | sort -u
svn pe svn:ignore .
svn propedit svn:ignore .
2010-08-26 06:57:17
User: Tungmar
Tags: svn

Standard command, but I always have to search for it... ;-)

svn status | grep "^\?" | awk '{print $2}' | xargs svn add
2010-08-14 18:56:15
User: kureikain
Functions: awk grep xargs
Tags: svn awk grep

When working on a big proeject with SVN, you create quite much files, for now! Can just sit here and type svn add for all of them!

svn status will return a list of all of file which get ?(not add), "M"(Modified), "D"(Deleted)! This code just grep "?" flag, then add it into SVN again!

svn st | grep -e '^M' | awk '{print $2}' | xargs svn revert
find . -name .svn -exec rm \-rf {} \;
svn merge -c -REV
2010-06-21 15:11:13
User: shadycraig
Functions: merge
Tags: svn merge revert

This command can be used to revert a particular changeset in the local copy.

I find this useful because I frequently import files into the wrong directory. After the import it says "Committed revision 123" or similar. to revert this change in the working copy do:

svn merge -c -123 .

(don't forget the .) and then commit.

svn st | awk '{if ($1 ~ "?") print $2}' | xargs svn add
2010-06-19 03:07:26
User: sciurus
Functions: awk xargs
Tags: svn awk

No need for grep, let awk do the match. This will not behave properly if the filenames contains whitespace, which is awk's default field separator.