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 by felix001 from sorted by
Terminal - Commands by felix001 - 20 results
ALT-U / ALT-L
xargs < [inputfile]
awk '{total+=$0}END{print total}' file
mkdir {1..100}
![command]
echo !$
if [ -x /sbin/arping ] ; then for i in {1..255} ; do echo arping 10.1.1.$i ; arping -c 1 10.1.1.$i | grep reply ; done ; fi
2011-02-21 21:03:09
User: felix001
Functions: echo grep
0

The following syntax will scan a range of IP addresses. At the point of a ARP response being received it will show a reply message.

www.fir3net.com

for i in `ndd /dev/ip \? | awk '{ print $1 }' | egrep -v "ip6|status|icmp|igmp|\?"` ; do echo $i `ndd -get /dev/ip $i` ; done | grep -v \?
2010-02-15 12:32:33
User: felix001
Functions: awk echo egrep grep
0

This command is jsut for the main IP settings of ndd. if you need ip6 or icmp edit the text within the egrep inclusion area.

Felix001 - www.Fir3net.com

> [filename].txt
2009-10-29 16:20:35
User: felix001
0

empties a file...

--- fir3net.com ---

x=1 ; while [ $x -le 10 ] ; do lynx -dump http://www.alexa.com/siteinfo/http://[YOUR WEBSITE] | grep Global | sed 's/ \|Global\|\,//g' >> /var/log/alexa-stats.txt ; sleep 5h ; done &
2009-10-17 13:48:05
User: felix001
Functions: grep sed sleep
0

This will record the Alexa Traffic Stats to a file and run every 5 hours.

-- www.fir3net.com --

HDD=$(df | awk ' NR>3 (S=$5) (M=$6) { if (S>90) print "Your Systems "M" is """S" Full" } ') ; [[ $HDD ]] && echo "$HDD" | mail -s "Hard-Drives Full" TO@EMAIL.com -- -f FROM@EMAIL.com >/dev/null
Putty -d 8080 [server]
2009-10-15 06:54:58
User: felix001
0

Run this on a windows machine then add your localhost as a socks server for port 8080 within your web browser. Your traffic will now be proxying and sent via your server over ssh.

ssh -R 2001:localhost:22 [username]@[remote server ip]
2009-10-11 09:51:04
User: felix001
Functions: ssh
7

Allows you to establish a tunnel (encapsulate packets) to your (Server B) remote server IP from your local host (Server A).

On Server B you can then connect to port 2001 which will forward all packets (encapsulated) to port 22 on Server A.

-- www.fir3net.com --

grep $'\t' file.txt
getenforce
2009-10-08 23:06:00
User: felix001
-5

Shows the status of SElinux.

-- fir3net.com --

rsop.msc
2009-06-26 11:19:50
User: felix001
4

Type this into windows via run and it will display to you your complete policy for windows. This includes group policy, security policy and your active directory account (min password etc)....

www.fir3net.com

watch 'netstat -aniv'
ffmpeg -i [source].avi -f mp4 -vcodec mpeg4 -b 250000 -s 480?320 -acodec aac -ar 24000 -ab 64 -ac 2 [destination].mp4
mkdir -p /cdrom/unnamed_cdrom ; mount -F hsfs -o ro `ls -al /dev/sr* |awk '{print "/dev/" $11}'` /cdrom/unnamed_cdrom
2009-05-31 08:42:20
User: felix001
Functions: awk mkdir mount
-2

This will allow you to mount a CD-ROM on Solaris SPARC 9 or lower. This will not work on Solaris 10 due to void and the volume management daemons.

www.fir3net.com

lshw -C disk -html > /tmp/diskinfo.html