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

Commands using alias from sorted by
Terminal - Commands using alias - 210 results
alias scd='dirs -v; echo -n "select number: "; read newdir; cd -"$newdir"'
alias rot13='perl -pe "y/A-Za-z/N-ZA-Mn-za-m/;"'
alias pi='`cat ~/.pi | grep ' ; alias addpi='echo "cd `pwd`" >> ~/.pi'
2009-02-05 15:46:59
User: senthil
Functions: alias grep
8

example:

--------------------------------------------------------------------------------------------

user@ubuntu:~/workspace/SVN/haystak-repos/trunk/internal/src$ addpi

--------------------------------------------------------------------------------------------

Now that directory is in the list of fast access directories.

You can switch to it anytime like this:

--------------------------------------------------------------------------------------------

user@ubuntu:~$ pi internal`

user@ubuntu:~/workspace/SVN/haystak-repos/trunk/internal/src$ --------------------------------------------------------------------------------------------

Please note the backquote ( the symbol that shares its key with ~ in the keyboard )

pi will switch you to that directory.

To see the list of all fast access directories you have to say "cat ~/.pi"

alias s='screen -X screen'; s top; s vi; s man ls;
2009-02-05 13:47:14
User: jonty
Functions: alias man
18

If you are already running screen then you often want to start a command in a fresh window. You use this alias by typing 's whatever' from your command line and 'whatever' starts running in a new window. Good with interactive commands like info, vim, and nethack.

alias 'ps?'='ps ax | grep '
alias rgrep="find . \( ! -name .svn -o -prune \) -type f -print0 | xargs -0 grep"
alias cdc='cd `pwd -P`'
alias beep='echo -en "\007"'
alias counts=sort | uniq -c | sort -nr
alias cr='find . 2>/dev/null -regex '\''.*\.\(c\|cpp\|pc\|h\|hpp\|cc\)$'\'' | xargs grep --color=always -ni -C2'
2009-01-26 08:54:25
User: chrisdrew
Functions: alias grep xargs
0

Creates a command alias ('cr' in the above example) that searches the contents of files matching a set of file extensions (C & C++ source-code in the above example) recursively within the current directory. Search configured to be in colour, ignore-case, show line numbers and show 4 lines of context. Put in shell initialisation file of your choice. Trivially easy to use, e.g:

cr sha1_init