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.

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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

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 - 212 results
alias bman='man --html=x-www-browser'
2016-10-23 17:59:47
User: lordtoran
Functions: alias
Tags: man groff

An easy alias for opening a manpage, nicely HTML formatted, in your set internet browser.

If you get a "command exited with status 3" error you need to install groff.

alias m='screen -S $$ -m script'
2015-10-01 18:07:18
Functions: alias
Tags: screen script

A quick alias I use right before logging into a server so that I have a log of the transactions as well as the ability to re-connect from another computer. Useful for when your boss says "what commands did you run again on that server?" and you had already closed the terminal ;)

I wrapped it in a script now, with more features, but this is the heart of it.

Never leave home without it.

alias lp="echo -n \"some text to copy\" | pbcopy; sleep 120 && echo -n \"done\" | pbcopy &"
2014-10-05 19:43:49
User: wsams
Functions: alias
Tags: alias pbcopy

This alias is useful if you need to use some text often. Executing the alias will copy the text into your clipboard and then remove it after X seconds.

alias noc="awk 'NF && ! /^[[:space:]]*#/'"
2014-09-07 00:50:57
User: pooderbill
Functions: alias

The shortest and most complete comment/blank line remover...

Any line where the first non-whitespace character is # (ie, indented # comments), and all null and blank lines are removed. Use the alias as a filter:

noc /etc/hosts


grep server /etc/hosts | noc

Change to nawk depending awk versions.

alias echourl="wget -qO -"
2014-06-14 00:23:07
User: Sepero
Functions: alias
Tags: wget

Directly send the content of a url to standard out. This command is most convenient for sending the output of a download directly to another command.

alias alive='(while true; do ping -c 4 > /dev/null 2>&1 ; sleep 300 ; done)'
2014-06-13 06:13:57
User: DarkXDroid
Functions: alias ping sleep

Everytime You Run Bash It Will Run And Send The Command To Background In A Loop Forever. This Is Useful In Android To Avoid Getting Discconnected While Using ADB Or Other Services Like SSH By Being Inactive For Long Periods Of Time. In My Case I Get Bash Full Suport Only Through ADB And Also A Decent Python Interpreter Using Python For Android.

alias pp='python -mjson.tool|pygmentize -l js'
2014-05-22 10:29:44
User: wires
Functions: alias
Tags: bash json

Leave out pygmentize or `pip install pygments` first.

function alls() { alias -p | sed -n "/^alias $1/p" }
2014-05-15 17:22:21
User: busterc
Functions: alias sed
Tags: alias aliases

Search, find and list aliases that match a regexp.

# basic search example:

alls c.*

# loose search example:

alls .*sudo.*

# remember to double escape special characters; example:

alls .*\\/.*
alias gitlog='git log -10 --graph --date-order -C -M --pretty=format:"%C(yellow)%h%C(reset) - %C(bold green)%ad%C(reset) - %C(dim yellow)%an%C(reset) %C(bold red)>%C(reset) %C(white)%s%C(reset) %C(bold red)%d%C(reset) " --abbrev-commit --date=short'
2014-05-08 09:43:55
User: deklau
Functions: alias

Cool alias that show a a better Git log

alias ...='while read line; do echo -n "."; done && echo ""'
alias oath='temp=$(pbpaste) && oathtool --base32 --totp "YOUR SEED HERE" | pbcopy && sleep 3 && echo -n $temp | pbcopy'
2014-03-14 19:21:18
Functions: alias echo sleep

Typing a word in terminal is easier than digging your phone out, opening your two-factor authentication app and typing the code in manually.

This alias copies the one-time code to your clipboard for 3 seconds (long enough to paste it into a web form), then restores whatever was on the clipboard beforehand.

This command works on Mac. Replace pbpaste/pbcopy with your distribution's versions.

alias t__s='date "+%FT%T"'
2014-03-06 04:37:55
User: UncleLouie
Functions: alias

This can be easier to look at in ls output. Not as clean as +%Y%m%dT%H%M%S, but quicker to write.

alias ...="awk '{fflush(); printf \".\"}' && echo \"\""
2014-02-22 22:20:22
User: lgarron
Functions: alias

If you're running a command with a lot of output, this serves as a simple progress indicator.

This avoids the need to use `/dev/null` for silencing. It works for any command that outputs lines, updates live (`fflush` avoids buffering), and is simple to understand.

alias t="tee >(pbcopy)"
2014-01-24 12:41:07
User: lgarron
Functions: alias

Very convenient to for sending data to the clipboard for processing.

However, note that tee will affect the buffering of the output (stdout won't be update very live).

alias ?=concalc
2014-01-02 01:46:44
User: boynux
Functions: alias

Same functionality without using bash functions.

alias ltmux="if tmux has-session -t $USER; then tmux attach -t $USER; else tmux new -s $USER; fi"
2013-12-10 14:46:28
Functions: alias
Tags: bash alias sh tmux

If a session with named the same as your username already exists, then attach to it, otherwise create it

alias tasks='git grep -EI "TODO|FIXME"'
2013-10-21 23:54:46
User: lizardo
Functions: alias grep
Tags: bash git todo

"git grep" automatically excludes untracked files (e.g. compiler output) and files under .git directory. If no directory or file is given, it will recursively search through the current directory.

alias tasks='grep --exclude-dir=.git -rEI "TODO|FIXME" . 2>/dev/null'
2013-10-17 16:40:10
User: joepie91
Functions: alias
Tags: bash todo

Place this in your .bashrc (or run it once) to set the `tasks` alias. Next time you enter `tasks` into a terminal, it will give you a list of all TODO and FIXME comments in the current directory and child directories, giving you a quick overview of what you still have to do!

alias timer='export ts=$(date +%s);p='\''$(date -u -d @"$(($(date +%s)-$ts))" +"%H.%M.%S")'\'';watch -n 1 -t banner $p;eval "echo $p"'
2013-08-24 16:18:45
User: ichbins
Functions: alias banner date eval watch
Tags: timer banner

Starts and shows a timer. banner command is a part of the sysvbanner package. Instead of the banner an echo or figlet commands could be used. Stop the timer with Ctrl-C and elapsed time will be shown as the result.

alias 2edit='xsel -b;n=pipe$RANDOM;xdotool exec --terminator -- mousepad $n -- search --sync --onlyvisible --name $n key --window %1 ctrl+v'
2013-08-11 06:18:31
User: ichbins
Functions: alias exec

bash output is inserted into the clipboard, then mousepad is started and the clipboard content is pasted. xsel and xdotool needs to be installed. Instead of the mousepad any other editor can be used. I've successfully tested the Sublime Text Editor and it opens a new tab for each new paste. Check Sample output for a usage example. This command is originated from here - http://goo.gl/0q9UT4

alias rn='mkdir -p ~/.rm`pwd`; mv -v -f --backup=t -t ~/.rm`pwd` "$@"'
alias clearscrollback='clear;printf %b "\033[3J"'
alias cls='clear;ls'
2013-03-19 12:18:47
User: opexxx
Functions: alias
Tags: ls clear

Clear the screen and list file

alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
2013-03-19 11:45:47
User: opexxx
Functions: alias

Add an "alert" alias for long running commands

alias gfind='find . -print0 | xargs -0 egrep -I '