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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

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



Commands tagged subversion from sorted by
Terminal - Commands tagged subversion - 16 results
svn log -v --xml > log.xml; zorba -q 'let $log := doc("log.xml")/log/logentry return for $author in distinct-values($log/author) order by $author return concat($author, " ", sum(count($log[author=$author]/paths/path)), "
")' --serialize-text
2013-03-22 11:17:10
User: langec
Functions: return

This saves Subversion's log output as XML and then runs an XQuery over it. This is standard XQuery 1.0 and should therefore also work with other XQuery processors. I have tested it with Zorba (http://www.zorba-xquery.com). XQilla (http://xqilla.sourceforge.net) also does it, but you'd have to save the query to a file and then execute "xqilla filename.xq".

The query first finds all distinct authors and then, for each author, sums up the number of paths they have changed in each commit. This accounts for commits of multiple changes at once.

The indenting space in all lines from the second one seems to be due to a bug in Zorba.

svnlook date /path/to/repo
2012-04-03 16:29:00
User: ijeyanthan
Functions: date

command to find out the unused SVN repositories from the server via svnlook. This lists the when the last commit (HEAD revision) has happened in the repository.

svnll(){svn log "$@"|( read; while true; do read h||break; read; m=""; while read l; do echo "$l" | grep -q '^[-]\+$'&&break; [ -z "$m" ] && m=$l; done; echo "$h % $m" | sed 's#\(.*\) | \(.*\) | \([-0-9 :]\{16\}\).* % \(.*\)#\1 \2 (\3) \4#'; done)}
2012-03-25 20:39:05
User: vhotspur
Functions: echo grep read sed
Tags: log subversion

Emulate (more or less) Git equivalent of

git log --format='tformat:%h %an (%cr) %s'
sudo svn co svn+ ciccio_diverso:[email protected]/svn-repo/progettino
2012-02-03 18:16:02
User: 0disse0
Functions: sudo
Tags: subversion

first need to Edit the configuration file


and under the [tunnels] add this line

ciccio_diverso = /usr/bin/ssh -p 12345

svn diff --diff-cmd='meld' -r 100:BASE FILE
svn info -R --xml file:///path/to/rep | grep kind=\"file\"|wc -l
2011-12-06 20:06:42
User: ijeyanthan
Functions: grep info wc
Tags: svn subversion

Number of files in a SVN Repository

This command will output the total number of files in a SVN Repository.

svn log -r '{YYYY-MM-DD}:{YYYY-MM-DD}' | sed -n '1p; 2,/^-/d; /USERNAME/,/^-/p' | grep -E -v '^(r[0-9]|---|$)' | sed 's/^/* /g'
2010-12-22 17:52:19
User: antic
Functions: grep sed

* Replace USERNAME with the desired svn username

* Replace the first YYYY-MM-DD with the date you want to get the log (this starts at the midnight event that starts this date)

* Replace the second YYYY-MM-DD with the date after you want to get the log (this will end the log scan on midnight of the previous day)

Example, if I want the log for December 10, 2010, I would put {2010-12-10}:{2010-12-11}

find . -type d -not \( -name .svn -prune \) -exec svn propset svn:ignore '*' {} \;
2010-08-15 03:45:57
User: tristan_ph
Functions: find

If you would like to ignore a directory including its subdirectory. For example, a tmp/ directory

find . -name .svn -exec rm \-rf {} \;
for d in $(find . -maxdepth 1 -type d -name '[^.]*'); do cd "$d"; svn up; cd ..; done
2010-05-28 10:09:19
User: udog
Functions: cd find

If you have a directory with many working copies of various subversion projects and you want to update them all at once, this one may be for you.

(for i in `find . -maxdepth 2 -name .svn | sed 's/.svn$//'`; do echo $i; svn info $i; done ) | egrep '^.\/|^URL'
2010-05-09 11:54:37
User: jespere
Functions: echo egrep info sed

If you have lots of subversion working copies in one directory and want to see in which repositories they are stored, this will do the trick. Can be convenient if you need to move to a new subversion server.

find . -type d -name .svn -exec chmod g+s "{}" \;
2010-04-27 16:51:00
User: mitzip
Functions: chmod find

The above command will set the GID bit on all directories named .svn in the current directory recursively. This makes the group ownership of all .svn folders be the group ownership for all files created in that folder, no matter the user.

This is useful for me as the subversion working directory on my server is also the live website and needs to be auto committed to subversion every so often via cron as well as worked on by multiple users. Setting the GID bit on the .svn folders makes sure we don't have a mix of .svn metadata created by a slew of different users.

export FIGNORE=.svn
2010-04-09 15:26:00
User: peter0081
Functions: export

When browsing java source code (for example) it's really annoying having to type the first letter of the package when there is only one package in the subdir.

man bash for more info about FIGNORE

svn log -v --xml file:///path/to/rep | grep kind=\"file\"|wc -l
2010-03-23 12:16:06
User: andremta
Functions: grep wc
Tags: svn subversion

This command will output the total number of files in a SVN Repository.

svn up | sed 's/\.//g' | cut -d ' ' -f3 | xargs svn log -r
find -type d -name ".svn" -prune -o -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type d -name ".svn" -prune -o -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
2010-01-28 09:45:29
User: 2chg
Functions: find md5sum sort uniq xargs

Improvement of the command "Find Duplicate Files (based on size first, then MD5 hash)" when searching for duplicate files in a directory containing a subversion working copy. This way the (multiple dupicates) in the meta-information directories are ignored.

Can easily be adopted for other VCS as well. For CVS i.e. change ".svn" into ".csv":

find -type d -name ".csv" -prune -o -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type d -name ".csv" -prune -o -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate