Commands by wzhd (1)

What's this? is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands

Check These Out

Convert a flv video file to avi using mencoder

List top 10 files in filesystem or mount point bigger than 200MB
Specify the size in bytes using the 'c' option for the -size flag. The + sign reads as "bigger than". Then execute du on the list; sort in reverse mode and show the first 10 occurrences.

generate 30 x 30 matrix
or $ od /dev/urandom -w60 -An|sed 's/ ..../ /g'|head -n 30 (this one lacks digits 8 and 9)

coloured shell prompt
This coloured prompt will show: username in green, grey "@" sign, hostname in red, current directory in yellow, typed commands in green.

Colorizes an access log
Puts a splash of color in your access logs. IP addresses are gray, 200 and 304 are green, all 4xx errors are red. Works well with e.g. "colorize access_log | less -R" if you want to see your colors while paging. Use as inspiration for other things you might be tailing, like syslog or vmstat Usage: $ tail -f access.log | colorize

Console clock
Shows a simple clock in the console -t param removes the watch header Ctrl-c to exit

find all active IP addresses in a network
You send a unicast ICMP packet to each host. Many firewalls will drop that ICMP. However, in order to send the ICMP, you'll have first done an ARP request and the remote machine is unlikely to ignore that, so the computer will be in your ARP table.

gh or "grep history" - define a function gh combining history and grep to save typing
By defining a function "gh" as shown here, it saves me typing "history | grep" every time I need to search my shell history because now I only have to type "gh". A nifty time saver :-) You can also add the "gh" function definition to your .bashrc so it is defined each time you login. (updated 2015_01_29: changed from hg to gh to avoid clash with that other hg command. mnemonic: gh = grep history)

Find artist and title of a music cd, UPC code given (first result only)
I like curl better than wget, I just think that curl -s is a lot simpler than wget ... see I forget what you even have to do to get wget to pipe it's output Anyway, all in one sed command as "requested"

check open ports without netstat or lsof

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.


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: