Commands by unixmonkey77071 (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 ascii string to hex
If you're going to use od, here's how to suppress the labels at the beginning. Also, it doesn't output the \x, hence the sed command at the end. Remove it for space separated hex values instead

make a log of a terminal session
Creates a log of a session in a file called typescript. Or specify the file with: $script filename Exit the session with control-d.

Redefine the cd command's behavior
Often, the very next command after the cd command is 'ls', so why not combine them?. Tested on a Red Hat derivative and Mac OS X Leopard Update: changed ${1:-$HOME} to "${@:-$HOME}" to accomodate directories with spaces in the names

find the 10 latest (modified) files
order the files by modification (thanks stanishjohnd) time, one file per output line and filter first 10

Display two calendar months side by side
Displays last month, current month, and next month side by side.

Delete all files by extension
This is a correction to Use `-name` instead of `-iname`, because case-sensitivity is probably important when we're dealing with filenames. It's true that extensions are often capitalised (e.g., "something.JPG"), so choose whatever's appropriate. However, what is appropriate is the quoting of the name pattern, so the shell doesn't expand it incorrectly. Finally, `-delete` is clearer.

Runs previous command replacing foo by bar every time that foo appears
Very useful for rerunning a long command changing some arguments globally. As opposed to ^foo^bar, which only replaces the first occurrence of foo, this one changes every occurrence.

Print permanent subtitles on a video (international edition :) )
If it's Hebrew [most probably all RTL languages. Comments?], add -flip-hebrew and -noflip-hebrew-commas to the mplayer switches: $ transcode -i myvideo.avi -x mplayer="-utf8 -flip-hebrew -noflip-hebrew-commas -sub" -o myvideo_subtitled.avi -y xvid

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

list block devices
Shows all block devices in a tree with descruptions of what they are.

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: