Hide

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.

Hide

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:

Hide

News

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.
Hide

Tags

Hide

Functions

All commands from sorted by
Terminal - All commands - 11,585 results
cd /some/directory \&\& tar cf - | cd /some/directory \&\& tar xvf - */
psnup -2 file.ps | lpr
psnup -4 -pa4 -Pa4 file.ps file2.ps
now=`date +"%Y/%m/%d" -d "04/02/2005"` ; end=`date +"%Y/%m/%d" -d "07/31/2005"`; while [ "$now" != "$end" ] ; do now=`date +"%Y/%m/%d" -d "$now + 1 day"`; echo "$now"; done
sar -g 5 5
find . -name "*.jpg" | perl -ne'chomp; $name = $_; $quote = chr(39); s/[$quote\\!]/_/ ; print "mv \"$name\" \"$_\"\n"'
last | awk '$1!~/wtmp/{logs[$1]++}END{for (i in logs) print i, logs[i]}'
last | awk '{ print $1 }' | sort | uniq -c | grep -v wtmp
rpm -qa --qf '%{name}'
rpm -qa --last
nroff -u0 -Tlp -man /usr/openwin/man/man1/Xsun.1 | col -x | less
2009-02-07 18:40:43
User: mnikhil
Functions: col
1

Using nroff , it is possible to view the otherwise garbled man page with col command.

df -kFufs
mkdir -p a/long/directory/path
2009-02-07 15:26:27
User: tjweir
Functions: mkdir
50

This will create the intermediate directories that do not exist.

I did not know about this for a long time.

plink lyu0@mysshserver -pw 123456
Place a filename at the beginning of the line to make it easier to edit the search at the end of the command.
echo SSBMb3ZlIFlvdQo= | base64 -d
sed -e 's/ *$//' ~/.bash_history | sort | uniq -cd | sort -nr | head
Use history -S in your .logout file
2009-02-07 10:53:14
User: vijucat
-1

That's the key part.

I got this from http://www.macosxhints.com/article.php?story=20070715091413640. See that article for other other, more basic, tcsh-specific history-related settings.

find ~ -name '*.sqlite' -exec sqlite3 '{}' 'VACUUM;' \;
2009-02-07 10:45:41
User: ggyy_sun
Functions: find
24

Compress information DBs of firefox to speed up the launch of browser.

sqlite3 ~/.liferea_1.4/liferea.db 'VACUUM;'
2009-02-07 10:40:02
User: ggyy_sun
1

If you use liferea frequently, you will see obvious speedup after you executed this command.

kill -HUP ` ps -aef | grep -i firefox | sort -k 2 -r | sed 1d | awk ' { print $2 } ' `
apt-cache search someregex
2009-02-07 09:15:19
User: chrisdrew
Functions: apt
0

Search the names and descriptions of all available packages and prints out the name and the short description.

xmms2 addpls cdda://
mount | grep : | tr -s ' ' -d 3 | xargs umount -v
# cut -d ' ' -f1 /var/log/nginx/nginx-access.log | sort | uniq -c | sort -nr | head -10 | nl