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

Remove comments and empty lines from a conf file
Some conf file are very long (squid.conf) This command help to read it.

Using a single sudo to run multiple && arguments
Bash's here string

MySQL dump restore with progress bar and ETA
Display a progress bar while restoring a MySQL dump.

Host cpu performance
Measure the cpu performance: In-case if the cpu is thermal throttling then you can find it using this command. Check the first line of the output. Example: Doing md5 for 3s on 16 size blocks: 11406892 md5's in 2.98s ? #(When cpu is not throttling) Doing md5 for 3s on 16 size blocks: 110692 md5's in 2.98s ?? #(When cpu is thermal throttling) Practical use case: Once we had cooling outage in data center which caused thermal throttling in some of the worker nodes. We used this tool to prove that some servers are not performing well because of the cpu thermal throttling.

Creates a symbolic link or overwrites an existing one
-n: dereference the existing link -v: (optional) to be sure of what is being done -f: force the deletion of the existing one -s: creates a symlink Be careful: the destination can also be a file or a directory and it will be overwritten.

Create a QR code image in MECARD format
Add the QR code image on your webpage, business card ., etc, so people can scan it and quick add to their Contact Address Book. Tested on iPhone with QRreader.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

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" }

Run a command, store the output in a pastebin on the internet and place the URL on the xclipboard
The URL can then be pasted with a middle click. This is probably useful when trying to explain problems over instant messaging when you don't have some sort of shared desktop.

ubuntu tasksel
The command tasksel allows the choice of packages from the command line to get predefined configurations for specific services (usually this option is offered during installation).

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: