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 using alias from sorted by
Terminal - Commands using alias - 211 results
alias path='echo $PATH | tr ":" "\n"'
2009-03-12 17:07:58
User: voyeg3r
Functions: alias tr

change ":" in path for new line and associate word path to var $PATH

alias lh='ls -a | egrep "^\."'
alias vb='vim ~/.bashrc; source ~/.bashrc'
2009-03-02 21:01:49
User: haivu
Functions: alias col groff man

Place the line above in your ~/.bahsrc file. Now every time you issue the 'vb' command, you invoke the vim editor to edit it, then source it so the changes take effect immediately.


* This mechanism is not working well if your .bashrc contains commands that should not be sourced more than once.

* This trick also work for your csh or tclsh users: place the following line in your ~/.cshrc file:

alias vc 'vim ~/.cshrc; source ~/.cshrc

Thank you adzap for pointing out the missing quote

alias calc 'echo "scale=4;\!*"|bc -l'; alias xcalc 'echo "\!*"|bc -l'
2009-02-28 21:30:59
User: boomer_tn
Functions: alias

allows simple C shell access to the power of bc - never could figure out how to do the same thing with Bash - that's why I use tcsh most of the time.

alias trash="rm -fr ~/.local/share/Trash"
2009-02-27 01:55:30
Functions: alias

Force empties the user trash

alias wordpress='mkdir wordpress && cd wordpress && wget http://wordpress.org/latest.tar.gz && tar -xvzf latest.tar.gz && mv wordpress/* . && rm -rf latest.tar.gz wordpress && cp wp-config-sample.php wp-config.php'
a() { alias $1=cd\ $PWD; }
2009-02-21 01:53:01
Functions: alias

An easy way to create aliases for moving between many directories

alias mine='ps xco pid,command,%cpu,%mem,state'
alias timestamp='date "+%Y%m%dT%H%M%S"'
2009-02-20 23:18:30
User: olifante
Functions: alias

I often need to add a timestamp to a file, but I never seem to remember the exact format string that has to be passed to the date command to get a compact datetime string like 20090220T231410 (i.e yyyymmddThhmmss, the ISO 8601 format popular outside the US)

alias ds='dig +noauthority +noadditional +noqr +nostats +noidentify +nocmd +noquestion +nocomments'
2009-02-19 17:32:56
Functions: alias

Turn off almost all of dig's output except for what you'd see in a zone file. This can also be put into ~/.digrc.

alias lrt='ls -lart'
alias rk='d=$(dcop|grep $PPID) && s=$(dcop $d konsole currentSession) && dcop $d $s renameSession'
2009-02-14 00:02:43
User: wwest4
Functions: alias

usage: renam

in a script you must replace $PPID with $(awk '{print $4}' /prod/$PPID/stat)

alias pubip='GET http://www.whatismyip.com/automation/n09230945.asp && echo'
2009-02-13 04:38:19
User: abcde
Functions: alias

Depends on GET. You can also replace GET with curl, or `wget -qO -` if GET isn't available.

alias chop="tr -d '\r\n'"
2009-02-13 01:44:11
User: wwest4
Functions: alias

similar to perl chop()

alias mute="dcop kmix Mixer0 toggleMasterMute\(\) ; dcop kmix Mixer0 masterMute\(\) | sed -e 's/true/muted/' -e 's/false/unmuted/' "
2009-02-12 04:56:33
User: wwest4
Functions: alias

arguably better than using the driver interface. lots of potentially cool stuff to be done w/ the dcop client.

alias dir="ls -al"
2009-02-11 16:51:01
User: katylava
Functions: alias

If you come from a DOS background and accidentally use DOS commands often, this and others like it can be helpful. Add to your .bash_profile, or wherever you keep such things.

alias apt-get='sudo apt-get'
2009-02-10 22:45:49
User: mogsie
Functions: alias

apt-get must be run as root, and it is useless to run it as your own user. So just run it as root. Saves you the "sudo !!" every time you're adding a package.

alias ll="ls -lh --color=auto"
alias ip4rev "echo \!* | sed 's/^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\4.\3.\2.\1/'"
2009-02-09 17:00:03
Functions: alias

For 'bash'

function ip4rev() { echo $@ | sed 's/^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\4.\3.\2.\1/'; }
alias ip4grep "grep -E '([0-9]{1,3}\.){3}[0-9]{1,3}'"
alias pfind='ps aux | grep '
alias ::='cd ../../'
alias acs='apt-cache search'
alias agi='sudo apt-get install'
alias grep 'gnu grep -i --color=auto'
2009-02-07 18:54:56
User: mnikhil
Functions: alias grep

Alias the grep command to show colored results by default.