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 - 206 results
alias s='ssh -l root'
2009-05-07 15:57:12
User: GouNiNi
Functions: alias
-20

When you have to manage lot of servers, it's boring to type ssh root@myhost for each connection. Now you can type juste "s someting" and you are connected.

You can too add bash_completion script to complet with tab the name of your servers. This will be the next tips from me ;)

alias xdef_load='xrdb -merge ~/.Xdefaults'
2009-05-05 16:34:06
User: P17
Functions: alias
0

Reads in the ~/.Xdefaults lexicographically sorted with, instead of replacing, the current contents of the specified properties.

alias b='cd -'
alias somafm='read -p "Which station? "; mplayer --reallyquiet -vo none -ao sdl http://somafm.com/startstream=${REPLY}.pls'
2009-05-05 12:13:46
User: denzuko
Functions: alias
-2

This is the alias command that I discussed in my prior release which you can add to your ~/.bashrc.

This command asks for the station name and then connects to somafm, Great for those who have linux home entertainment boxes and ssh enabled on them, just for the CLI fiends out there ( I know I'm one of them ;)

You can find future releases of this and many more scripts at the teachings of master denzuko - denzuko.co.cc.

alias dfr='df;free'
2009-04-28 11:30:31
User: ximo88
Functions: alias
-9

A short way to give us relevant report in a moment done about quantities on disk usage, memory and swap in our Linux Systems.

alias h='history'
2009-04-28 11:20:03
User: ximo88
Functions: alias
-8

typing history it's a long way but typing only h it's my way it works in whatever distro or OSes or shells that you use, you know, only for easyness :)

alias lg='ls --color=always | grep --color=always -i'
2009-04-11 23:15:12
User: kFiddle
Functions: alias grep
Tags: ls alias color grep
6

This is a simple command, but extremely useful. It's a quick way to search the file names in the current directory for a substring. Normally people use "ls *term*" but that requires the stars and is not case insensitive. Color (for both ls and grep) is an added bonus.

alias backup_dir='mkdir -p .backup && cp * .backup'
2009-04-06 14:43:21
User: k00pa
Functions: alias cp
-3

Add this to .bashrc, then you can quickly create backups from files on current directory, but it only backups files on current directory.

useful when changing config files, coding something or just trying something stupid.

alias rot13="tr '[A-Za-z]' '[N-ZA-Mn-za-m]'"
2009-03-30 19:08:49
User: penpen
Functions: alias
Tags: Linux unix
9

rot13 maps a..mn..z (A..MN..Z) to n..za..m (n..za..m) and so does this alias.

alias l='ls -CFlash'
2009-03-30 17:11:31
Functions: alias
2

create a short alias for 'ls' with multi-column (-C), file type syntax additions (slashes after directories, @ for symlinks, etc... (-F), long format (-l), including hidden directories (all ./, ../, .svn, etc) (-a), show file-system blocks actually in use (-s), human readable file sizes (-h)

alias up="cd .."; alias upp="cd ../.."; alias uppp="cd ../../.."; alias upppp="cd ../../../.."; alias uppppp="cd ../../../../.."
alias tree="tree -CAFa -I 'CVS|*.*.package|.svn|.git' --dirsfirst"
2009-03-27 05:13:39
User: isaacs
Functions: alias
Tags: tree
7

I got really tired of having tree always show me tons of .svn and .git stuff that I don't care about. With this alias, "tree" uses pretty colors, snazzy line graphics, and ignores any source control and package mumbojumbo. (Customize the *.*.package glob, of course.)

alias showip="ifconfig eth0 | grep 'inet addr:' | sed 's/.*addr\:\(.*\) Bcast\:.*/\1/'"
2009-03-25 07:50:12
User: dizzgo
Functions: alias
Tags: ifconfig alias IP
0

parses the output of ifconfig to show only the configured ip address (in this case from interface eth0).

the regexp is quick'n'dirty im sure it can be done in a better way.

--> this alias does not show your "internet ip" when you're in a nat-environment

alias tproxy='ssh -ND 8118 user@server&; export LD_PRELOAD="/usr/lib/libtsocks.so"'
alias myip='curl -s www.wieistmeineip.de | egrep -o "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"'
alias mux='clear && cd ~/Music/ && ls && echo -n "File> " && read msi && mplayer ~/Music/$msi'
2009-03-23 10:45:27
User: Noxn
Functions: alias cd echo ls read
-2

An alias i made for myself to play music in a faster way.

Works great when you have Guake / Tilda installed (Console that drops down like in the game QUAKE)

---

I put this in my bash_alias file (I'm on ubuntu, the bash_alias file does autostart with the right config) but it works putting it in bashrc too. Or anything that autostarts when the console is opened.

---

Needs Mplayer and music files to work. With out music theres nothing to play!

Oh, and also, without modification, this alias will try to play stuff from your ~/Music folder! (case sensitive). Make sure that folder exists and has music OR edit this alias to fit your needs.

alias opened='p4 opened | awk -F# "{print \$1}"'
2009-03-20 11:06:41
User: Alexander
Functions: alias awk
Tags: p4 SCM Perforce
0

Just type 'opened' and get all files currently opened for edit.

alias pst='pstree -Alpha'
2009-03-20 10:53:37
User: Alexander
Functions: alias
Tags: Linux
0

By 'pst' you can print out process tree with all details about all processes (including a command line, PID, and the current process you are running in).

By 'pst username' you can get an information about processes belonging to the particular user 'username'.

alias ..='cd ..'
2009-03-20 09:57:28
User: eimantas
Functions: alias
Tags: bash unix shell cd
9

Alias two dots to move to parent directory. Put it into your .bashrc or .profile file.

alias lvim="vim -c \"normal '0\""
alias path='echo $PATH | tr ":" "\n"'
2009-03-12 17:07:58
User: voyeg3r
Functions: alias tr
-1

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
2

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.

Notes:

* 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
1

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
-4

Force empties the user trash