Commands by drjones (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

Mount a disk image (dmg) file in Mac OSX
To unmount, replace "attach" with "eject"

Show this month's calendar, with today's date highlighted
Explanation: * The date command evaluated to today's date with blank padded on the left if single digit * The grep command search and highlight today's date * The --before-context and --after-context flags displays up to 6 lines before and after the line containing today's date; thus completes the calendar. I have tested this command on Mac OS X Leopard and Xubuntu 8.10

about how using internal separate field and store file content on variable

Look for English words in /dev/urandom
* to get the English dictionary: wget

Converting video file (.flv, .avi etc.) to .3gp
ffmpeg -i = input file name -s = set frame size, qcif=176x144 -vcodec = force video codec -r = frame-rate [default = 25] -b = bit-rate [200 kb/s] -acodec = force audio codec -ab = audio bitrate in bits/s [64k] -ac = no. of audio channels [1] -ar = audio sampling frequency [44100 Hz] optional: -sameq = use same video quality as source (implies VBR) -f = force format -y = overwrite output files

The BOFH Excuse Server

most used unix commands

Show database sql schema from Remote or Local database
After ssh into server, run this command to show all the table structure and schema.

keep a log of the active windows
This logs the titles of the active windows, thus you can monitor what you have done during which times. (it is not hard to also log the executable name, but then it is gets too long)

rsync directory tree including only files that match a certain find result.
'-mtime -10' syncs only files newer 10 days (-mtime is just one example, use whatever find expressions you need) printf %P: File's name with the name of the command line argument under which it was found removed. this way, you can use any src directory, no need to cd into your src directory first. using \\0 in printf and a corresponding --from0 in rsync ensures that even filenames with newline characters work (thanks syssyphus for #3808). both, #1481 and #3808 just work if you either copy the current directory (.) , or the filesystem root (/), otherwise the output from find and the source dir from rsync just don't match. #7685 works with an arbitrary source directory.

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: