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 LS='find -mount -maxdepth 1 -printf "%.5m %10M %#9u:%-9g %#5U:%-5G %TF_%TR %CF_%CR %AF_%AR %#15s [%Y] %p\n" 2>/dev/null'
2013-02-06 17:54:14
User: AskApache
Functions: alias

This alias is super-handy for me because it quickly shows the details of each file in the current directory. The output is nice because it is sortable, allowing you to expand this basic example to do something amazing like showing you a list of the newest files, the largest files, files with bad perms, etc..

A recursive alias would be:

alias LSR='find -mount -printf "%.5m %10M %#9u:%-9g %#5U:%-5G %TF_%TR %CF_%CR %AF_%AR %#15s [%Y] %p\n" 2>/dev/null'

From: http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html

alias updatedb="sudo /usr/libexec/locate.updatedb"
2013-01-21 17:46:57
User: jhyland87
Functions: alias

MAC OSX doesn't come with an updatedb command by default, this will emulate the updatedb thats on a typical Linux OS.

Simply add it to your ~/.bash_profile

alias locate='if [ $((`date +%s`-`eval $(stat -s /var/db/locate.database); echo $st_mtime`)) -gt 3600 ]; then echo "locate: db is too old!">/dev/stderr; sudo /usr/libexec/locate.updatedb; fi; locate -i'
2013-01-21 17:45:50
User: jhyland87
Functions: alias echo locate stat sudo
Tags: locate osx mac

MAC OSX doesn't come with a locate command, This will do the same thing as the locate command on a typical Linux OS.

Simply add it to your ~/.bash_profile

alias ssh-x='ssh -c arcfour,blowfish-cbc -XC'
function map() { [ -n "$1" ] && alias $1="cd `pwd`" || alias | grep "'cd "; }
alias ll='ls -lisaG'
alias emacs='vim'
alias colortest="python -c \"print('\n'.join([(' '.join([('\033[38;5;' + str((i + j)) + 'm' + str((i + j)).ljust(5) + '\033[0m') if i + j < 256 else '' for j in range(10)])) for i in range(0, 256, 10)]))\""
2012-10-26 07:43:06
User: Paaskehare
Functions: alias

Terminal Color tester using python, works with py2 and 3

alias sdr="screen -dR"
2012-10-22 21:46:26
User: tox2ik
Functions: alias
Tags: bash screen

There is no need to use the shell or construct. Screen offers varius ways of detaching and reattaching. man screen and look for -[rRdD].

to create a named session: sdr moo


resume: sdr moo

alias pp='python -mjson.tool | pygmentize -l javascript'
2012-10-16 13:55:38
User: wires
Functions: alias

Uses pygmentize and python to create indented and colorized JSON output

alias g='git'
2012-08-31 05:12:56
User: evandrix
Functions: alias
Tags: git

g clone --local --bare . /repo.git

g remote add alias /repo.git

g push alias branch

g log -p filename

g checkout SHA1_rev

g reset --hard

g checkout -b new_branch

g ls-files --deleted

alias rrm='/bin/rm -i'; alias rm='trash'
2012-08-12 14:02:24
User: expelledboy
Functions: alias
Tags: rm safe

Replace rm, a neat shortcut, with a less permanent method of removal.

Note may require you to install the trash client; "sudo apt-get -y install trash-cli"

alias irc="screen -D -R -S chatclient irssi"
2012-08-12 13:24:43
User: expelledboy
Functions: alias

This command attempts to attach to existing irssi session, if one exists, otherwise creates one.

I use "irc" because I use different irc clients depending on what system I am working on. Consistency is queen.

alias ls='if [[ -f .hidden ]]; then while read l; do opts+=(--hide="$l"); done < .hidden; fi; ls --color=auto "${opts[@]}"'
2012-08-12 13:10:23
User: expelledboy
Functions: alias ls read
Tags: hidden ls alias

Sometimes I would like to see hidden files, prefix with a period, but some files or folders I never want to see (and really wish I could just remove all together).

alias md='mkdir -p'; alias rd='rmdir'; mcd () { mkdir "$@" && cd "$_"; }
2012-08-12 12:54:51
User: expelledboy
Functions: alias cd mcd mkdir

I realise that this is just a reiteration of another entry (regardless of whether I came up with all this all by myself), but I would like present my additional alias' in context as a method of managing your directories. Rather convenient.

alias ':q'='exit'; alias ':e'='vim';
2012-08-12 12:35:10
User: expelledboy
Functions: alias
Tags: vim alias

This was me just succumbing to the habits, but now I rarely use quit or vim directly, so beware! :)

alias pasteit="curl -F 'sprunge=<-' http://sprunge.us"
2012-07-19 19:46:39
User: frdmn
Functions: alias
Tags: pastebin


sprunge: command line pastebin:


| curl -F 'sprunge=


add ? to resulting url for line numbers and syntax highlighting


~$ cat bin/ching | curl -F 'sprunge=


~$ firefox http://sprunge.us/VZiY?py#n-7



alias myip='curl -s http://checkrealip.com/ | grep "Current IP Address"'
alias vless='/usr/share/vim/vimcurrent/macros/less.sh'
2012-04-28 23:01:25
User: Bonster
Functions: alias

use vim like less command pager but with color highlighting = pretty :p

also u can use /usr/share/vim/vim73/macros/less.sh

alias fu='curl -s http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext | grep -vE "^$|^#"'
2012-04-16 05:53:56
User: kordless
Functions: alias grep

Put this in your bash startup script so you can quickly remember the top rated commands on CommandLineFu's website. Put it in .bashrc on Linux, or .bash_profile on OSX.

alias html2ascii='lynx -force_html -stdin -dump -nolist'
alias b='cd ../'
2012-04-01 06:04:45
User: deshawnbw
Functions: alias
Tags: alias

Alias a single character 'b' to move to parent directory. Put it into your .bashrc or .profile file.

Using "cd .." is one of the most repetitive sequence of characters you'll in the command line. Bring it down to two keys 'b' and 'enter'.

It stands for "back"

Also useful to have multiple:

alias b='cd ../'

alias bb='cd ../../'

alias bbb='cd ../../../'

alias bbbb='cd ../../../../'

alias man='man -S 2:3:1'
alias tail='tail -n $((${LINES:-`tput lines 2>/dev/null||echo -n 80`} - 7))'
2012-03-22 02:44:11
User: AskApache
Functions: alias echo

Run the alias command, then issue

ps aux | tail

and resize your terminal window (putty/console/hyperterm/xterm/etc) then issue the same command and you'll understand.

${LINES:-`tput lines 2>/dev/null||echo -n 12`}

Insructs the shell that if LINES is not set or null to use the output from `tput lines` ( ncurses based terminal access ) to get the number of lines in your terminal. But furthermore, in case that doesn't work either, it will default to using the default of 80.

The default for TAIL is to output the last 10 lines, this alias changes the default to output the last x lines instead, where x is the number of lines currently displayed on your terminal - 7. The -7 is there so that the top line displayed is the command you ran that used TAIL, ie the prompt.

Depending on whether your PS1 and/or PROMPT_COMMAND output more than 1 line (mine is 3) you will want to increase from -2. So with my prompt being the following, I need -7, or - 5 if I only want to display the commandline at the top. ( http://www.askapache.com/linux/bash-power-prompt.html )


[7995:7993 - 0:186] 06:26:49 Thu Apr 08 [askapache@n1-backbone5:/dev/pts/0 +1] ~

In most shells the LINES variable is created automatically at login and updated when the terminal is resized (28 linux, 23/20 others for SIGWINCH) to contain the number of vertical lines that can fit in your terminal window. Because the alias doesn't hard-code the current LINES but relys on the $LINES variable, this is a dynamic alias that will always work on a tty device.

alias sshto 'ssh -X -t \!:1 "cd \!:2 ; tcsh"'
2012-03-20 20:07:37
User: pranavkn
Functions: alias

Changes machine and cd to specific directory

Add to .*shrc

Usage :