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

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

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

Find class in jar

Write comments to your history.
A null operation with the name 'comment', allowing comments to be written to HISTFILE. Prepending '#' to a command will *not* write the command to the history file, although it will be available for the current session, thus '#' is not useful for keeping track of comments past the current session.

Check if x509 certificate file and rsa private key match
A x509 certificate and a rsa key file have in common a parameter called modulus, it is a very long hexadecimal number. That value is unique for each certficate / key pair. The command allows to do the check of this pair of values in a script using a great feature of bash. "

Console clock
Shows a simple clock in the console -t param removes the watch header Ctrl-c to exit

scroll file one line at a time (w/only UNIX base utilities)
usage examples ls largedir |rd lynx -dump |rd rd < largelogfile

kill process by name
Or even easier, if it's available: $ killall firefox I have no idea why you would want to rely on two unusual dependencies to do something that can be done a hundred ways from coreutils...

Slow down the screen output of a command
(example above is the 'ls' command with reduced output speed)

watch your network load on specific network interface
-n means refresh frequency you could change eth0 to any interface you want, like wlan0

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: