Commands by starchox (26)

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

Quick HTML image gallery from folder contents with Perl
This includes a title attribute so you can see the file name by hovering over an image. Also will hoover up any image format - jpg, gif and png.

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

Download from Rapidshare Premium using wget - Part 1
In order to do that, first you need to save a cookie file with your account info. These commands do it (maybe you need to create the '.cookies' dir before). Also, you need to check the "Direct downloads" option on the Premium Zone >> Settings tab. You need to do this once (as long you maintain the file or your Rapidshare Premium account).

watch snapshots commit in VMware ESX
To monitor .vmdk files during snapshot deletion (commit) on ESX only (ESXi doesn't have the watch command): 1. Navigate to the VM directory containing .vmdk files. # watch "ls -tough --full-time *.vmdk" where: -t sorts by modification time -o do not list group information (to narrow the output) -u sorts by access time -g only here for the purpose to easily remember the created mnemonic word 'tough' -h prints sizes in human readable format (e.g., 1K 234M 2G) --full-time sets the time style to full-iso and does not list user information (to narrow the output) optionally useful parameters to the watch command: -d highlight changes between updates -n seconds to wait between updates (default is 2) -t turn off printing the header

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Dock Thunderbird in system tray and hide main window
Dock Thunderbird in system tray and hide main window. Very useful for startup scripts. Of course you can dock any app of your choice.

Print a list of installed Perl modules
This version works on an AIX system on which I have very limited permissions. The other version fails with "Can't open file /usr/opt/perl588/lib/site_perl/5.8.8/aix/auto/DBI/.packlist".

Easy and fast access to often executed commands that are very long and complex.
When using reverse-i-search you have to type some part of the command that you want to retrieve. However, if the command is very complex it might be difficult to recall the parts that will uniquely identify this command. Using the above trick it's possible to label your commands and access them easily by pressing ^R and typing the label (should be short and descriptive). UPDATE: One might suggest using aliases. But in that case it would be difficult to change some parts of the command (such as options, file/directory names, etc).

Run the last command as root - (Open)Solaris version with RBAC

Generate a playlist of all the files in the directory, newer first
I use this to generate a playlist with all the podcasts I listen to. Ordered from most recent to older.

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: