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.

World cup college
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

2010-03-18 - Top 10 commands explained
There's a great article by Peteris Krumins explaining the current top 10 commands: http://www.catonmat.net/blog/top-ten-one-liners-from-commandlinefu-explained/
2010-03-03 - Commandlinefu @ SXSW 2010
Am going to be at SXSW this year, in case you want to submit any CLI nuggets or suggestions to me in person. Ping me on the @codeinthehole Twitter account.
2009-09-12 - Email updates now available
You can now enable email updates to let you know each time you're command is commented on.
2009-07-11 - API and javascript blog widget now available
A simple API has been released, allowing commands to be retrieved in various formats. This also allows commands to be embedded on blogs/homepages.
Hide

Tags

Hide

Functions

All commands

All commands from sorted by
Terminal - All commands - 5,794 results
ping -q -c1 -w3 brandx.jp.sme >& /dev/null || echo brandx.jp.sme ping failed | mail -ne -s'Server unavailable' joker@jp.co.uk
2010-09-08 12:19:29
Functions: echo mail ping
Tags: bash ping mail
0

For some reason the 2&>1 does not work for me, but the shorter stdout/stderr redirection >& works perfectly (Ubuntu 10.04).

windows password recovery tool, windows password recovery software
2010-09-08 08:30:29
User: kirahjin
-8

This article introduces 6 best Windows password recovery tool to help you recover your lost Windows password. Both free one and commercial one are available.

echo "w" | fdisk /dev/sdb
2010-09-07 13:42:59
User: BCK
Functions: echo fdisk
-1

Used this after cloning a disk with dd to make the newly written partitions show up in /dev/

wget -q $(lynx --dump 'http://geekandpoke.typepad.com/' | grep '\/.a\/' | grep '\-pi' | head -n 1 | awk '{print $2}') -O geekandpoke.jpg
perl -e 'print "\n"x100'
2010-09-07 10:11:10
User: SunX
Functions: perl
0

Perl variant of echo several blank lines command

for i in `seq 1 100`;do echo;done
2010-09-07 09:55:35
User: javisol
0

Sometimes I need to move several blank lines my terminal, I usually use this command, does anybody know a better one?

Thanks

ls -lAhutr
2010-09-07 05:49:46
Functions: ls
-3

This is a simple command, but useful when you don't remember what episode need to see :D

function ldd(){ objdump -p $1 | grep -i need; }
2010-09-07 02:44:59
User: jyf
Functions: grep objdump
Tags: ldd
0

use this to avoid executing the target app

ldd path_to_executable
svn log 2>&1 | egrep '^r[0-9]+' | cut -d "|" -f2 | sort | uniq -c
LD_TRACE_LOADED_OBJECTS=1 name_of_executable
feh --bg-center `ls | shuf -n 1`
feh --bg-center `ls -U1 |sort -R |head -1`
( x=`tput op` y=`printf %$((${COLUMNS}-6))s`;for i in {0..256};do o=00$i;echo -e ${o:${#o}-3:3} `tput setaf $i;tput setab $i`${y// /=}$x;done; )
0

This is super fast and an easy way to test your terminal for 256 color support. Unlike alot of info about changing colors in the terminal, this uses the ncurses termcap/terminfo database to determine the escape codes used to generate the colors for a specific TERM. That means you can switch your terminal and then run this to check the real output.

tset xterm-256color

at any rate that is some super lean code!

Here it is in function form to stick in your .bash_profile

aa_256 ()

{

( x=`tput op` y=`printf %$((${COLUMNS}-6))s`;

for i in {0..256};

do

o=00$i;

echo -e ${o:${#o}-3:3} `tput setaf $i;tput setab $i`${y// /=}$x;

done )

}

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

lsof /folder
2010-09-06 05:10:06
User: dotanmazor
Tags: lsof umount
4

Instead of using force un-mounting, it's better to find the processes that currently use the relevant folder.

Taken from:

http://www.linuxhowtos.org/Tips%20and%20Tricks/findprocesses.htm

cowsay -l | sed '1d;s/ /\n/g' | while read f; do cowsay -f $f $f;done
blkid /dev/sda7
2010-09-05 12:20:45
User: lineak
Tags: partition uuid
1

Shows the UUID of the given partition (here /dev/sda7). Doesn't need to be root.

cp -n <src> <dst>
yes n | cp -p -i -r <src> <dest>
ls /dev/disk/by-uuid/ -alh
lynx -dump http://domaim.com | egrep -o -e 'http://[/0-9a-z.]+html'
~.
2010-09-04 15:13:10
User: xeor
Tags: ssh
6

~ is the ssh control character. If you type it after a newline, you can example force close the ssh session.

, ~, then .

If you want more info, type ~? when you are connecting using ssh.

Very useful to kill of any hanging ssh sessions when nothing else works.

dog --links "http://www.domain.com"