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.


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:



2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.




All commands from sorted by
Terminal - All commands - 11,621 results
while [ ! -f /tmp/stop ]; do ssh -o ExitOnForwardFailure=yes -R 2222:localhost:22 target "while nc -zv localhost 2222; do sleep 5; done"; sleep 5;done
diff <(ssh nx915000 "rpm -qa") <(ssh nx915001 "rpm -qa")
echo -n m{1..5}.cluster.net | xargs -d' ' -n1 -P5 -I{} ssh {} 'uptime'
wget -qO - "http://www.tarball.com/tarball.gz" | tar zxvf -
perl -e "''=~('(?{'.('-^@.]|(;,@/{}/),[\\\$['^'],)@)[\`^@,@[*@[@?}.|').'})')"
dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp
2009-02-08 10:10:00
User: morpheus
Functions: dd ssh

This will output the sound from your microphone port to the ssh target computer's speaker port. The sound quality is very bad, so you will hear a lot of hissing.

cd //
head -1000 < lines.txt | tail -1
cp -pr directory-you-want-to-backup{,_`date +%Y%m%d`} # for bash
cp -p file-you-want-backup{,_`date +%Y%m%d`} # for bash
while [ 1 ]; do date; ls -l /path/to/dir; sleep 1; done
sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 /file/of/ip/addresses
rak "what you're searching for" dir/path
( while read File; do mogrify -resize 1024 -quality 96 $File; done ) < filelist
2009-02-08 02:48:26
User: Corsair
Functions: read

Imagemagick library is used. If image format is not JPEG, the "quality" option should not be issued.

for File in *.jpg; do mogrify -resize 1024 -quality 96 $File; done
ldconfig -p | grep <somenewlib.so>
2009-02-07 23:15:38
User: al3x
Functions: grep ldconfig

Allows to check if shared library could be dynamically loaded

ldd <executable binary>
2009-02-07 23:13:40
User: al3x
Functions: ldd

provides list of shared libraries required by executable

rpm -qlp <package.rpm>
2009-02-07 23:11:59
User: al3x
Functions: rpm

allows to check inside rpm file w/o installing it

ls -al /proc/<PID>/fd
2009-02-07 22:57:03
User: al3x
Functions: ls

Useful for examining hostile processes (backdoors,proxies)

dscacheutil -flushcache
alias acs='apt-cache search'
alias agi='sudo apt-get install'
sudo echo 1 > /proc/acpi/asus/camera
2009-02-07 21:57:01
User: orie
Functions: echo sudo

In some applications on eeepc xandros 7, default OS, video ccamera is not available untill you enter this command

find /path -name \*.php -user nobody -exec grep -nH whatever {} \;
2009-02-07 20:53:56
User: al3x
Functions: find grep

allows to grep very narrow subset of files

find /path -type d -perm 777 -exec chmod 755 {} \;