Commands by birnam (4)

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

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Suspend to ram

Nicely display mem usage with ps
Nicely display mem usage with ps.

vim as a pager - similar to less command but with color
use vim like less command pager but with color highlighting = pretty :p also u can use /usr/share/vim/vim73/macros/

Rename files in batch

convert single digit to double digits
Uses 'rename' to pad zeros in front of first existing number in each filename. The "--" is not required, but it will prevent errors on filenames which start with "-". You can change the "2d" to any number you want, equaling the total numeric output: aka, 4d = ????, 8d = ????????, etc. I setup a handful of handy functions to this effect (because I couldn't figure out how to insert a var for the value) in the form of 'padnum?', such as: padnum5 () { /usr/bin/rename 's/\d+/sprintf("%05d",$&)/e' -- [email protected] } Which would change a file "foo-1.txt" to "foo-00001.txt"

Rename all files which contain the sub-string 'foo', replacing it with 'bar'
Would this command line achieve the desired function? My CLI knowledge is not great so this could certainly be wrong. It is merely a suggestion for more experienced uses to critique. Best wishes roly :-)

Your name backwards

Clear ARP table in linux.
Clears the "arp" table, without entering manually addresses (tested in Ubuntu).

Toggle a temporary ram partition
Creates a temporary ram partition To use: ram 3 to make a 3gb partition (Defaults to 1gb)

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: