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.

If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

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





Commands by Cowboy from sorted by
Terminal - Commands by Cowboy - 13 results
(cd src && tar -cf - .) | (cd dest && tar -xpf -)
2011-09-22 11:30:57
User: Cowboy
Functions: cd tar

Simple tar pipe to be used to copy directories while including hidden files and maintaining file permissions

while true; do wget -r -l1 --no-clobber -A.txt http://911.wikileaks.org/files/index.html; done; cat *.txt | grep pass
for URL in `wget -O - http://api.flickr.com/services/feeds/photos_public.gne?tags=bitch,bw 2>/dev/null | grep -E -o "http[^ ]+?jpg" | grep -v "_m" | uniq | grep -v 'buddy' `; do FILE=`echo $URL | grep -E -o "[0-9a-z_]+\.jpg"`; curl $URL > $FILE; done;
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
mount -t ntfs-3g -o ro,loop,uid=user,gid=group,umask=0007,fmask=0117,offset=0x$(hd -n 1000000 image.vdi | grep "eb 52 90 4e 54 46 53" | cut -c 1-8) image.vdi /mnt/vdi-ntfs
mount -t unionfs -o dirs=/tmp/unioncache=rw:/mnt/readonly=ro unionfs /mnt/unionfs
2009-08-23 14:16:13
User: Cowboy
Functions: mount

First look into /etc/modules if you have unionfs (or squashfs) support. If not, add the modules. UnionFS combines two filesystems. If there is a need to write a file, /tmp/unioncache will be used to write files (first create that directory). Reads will be done where the file is found first.


tar -C /oldirectory -cvpf - . | tar -C /newdirector -xvf -
2009-08-22 20:05:49
User: Cowboy
Functions: tar

It's the same like 'cp -p' if available. It's faster over networks than scp. If you have to copy gigs of data you could also use netcat and the tar -z option in conjunction -- on the receiving end do:

# nc -l 7000 | tar -xzvpf -

...and on the sending end do:

# tar -czf - * | nc otherhost 7000

mysql -u<user> -p<password> -s -e 'DESCRIBE <table>' <database> | tail -n +1 | awk '{ printf($1",")}' | head -c -1
vditool COPYDD my.vdi my.dd ; sudo mount -t ntfs -o ro,noatime,noexex,loop,offset=32256 my.dd ./my_dir
SERVER: nc -l p 666 CLIENT: telnet -l -p 666
2009-08-14 17:01:57
User: Cowboy
Functions: telnet

This will start a netcat process listening on port 666. If you are able connect to your your server, netcat will receive the data being sent and spit it out to the screen (it may look like random garbage, so you might want to redirect it to a file).

grep -E ":(`cat bnd-ips.txt | sed 's/\./\\./g' | tr '\n' '|'`)" access.log
2009-07-30 12:54:55
User: Cowboy
Functions: grep

bnd-ips.txt is a list of IP adresses that is concenated for use as regular expression. Yes, this is still very speedy ;=)

cat myfile.txt | tr -d '\n'
svn log | tr -d '\n' | sed -r 's/-{2,}/\n/g' | sed -r 's/ \([^\)]+\)//g' | sed -r 's/^r//' | sed -r "s/[0-9]+ lines?//g" | sort -g
2009-06-29 12:48:30
User: Cowboy
Functions: sed sort tr

Note you have also the --xml option ;)