Commands by ratonovitch (4)

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

Show Directories in the PATH Which does NOT Exist
I often need to know of my directory in the PATH, which one DOES NOT exist. This command answers that question * This command uses only bash's built-in commands * The parentheses spawn a new sub shell to prevent the modification of the IFS (input field separator) variable in the current shell

Another Curl your IP command
Just another curl command to get your public facing IP

Create a bunch of dummy text files

Disassemble some shell code
This one liner takes the shell code that you can grab off of the web and disassemble it into readable assembly so you can validate the code does what it says, before using it. The shell code in the above example is from You can replace "-s intel" with "-s att" to get AT&T format disassembly.

dd with progress bar and statistics
Uses the pv utility to show progress of data transfer and an ETA until completion. You can install pv via Homebrew on macOS

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

Do command when logged in from certain ips using ssh
Place in ~/.bashrc If you login to a ssh server from different ips, sometimes you want to do something specific for each. e.g., quickly go into screen -x session from a phone, but not your desktop.

Console screensaver.

Save all commands from to plain text sort by vote
Faster then other method using wget For obtain all commands use $nu=`curl |grep -o "Terminal - All commands -.*results$" | grep -oE "[[:digit:],]{4,}" | sed 's/,//'`; $curl[0-"$nu":25] | grep -vE "_curl_|\.com by David" > clf-ALL.txt For more version specific $nu=`curl |grep -o "Terminal - All commands -.*results$" | grep -oE "[[:digit:],]{4,}" | sed 's/,//'`; $curl[0-"$nu":25] | grep -vE "_curl_|\.com by David" > clf-ALL_"$nu".txt Also download dirctly from my dropbox My drop box invitaion link is . Use it and get free 2.5 GB space.

Prints total line count contribution per user for an SVN repository
I'm working in a group project currently and annoyed at the lack of output by my teammates. Wanting hard metrics of how awesome I am and how awesome they aren't, I wrote this command up. It will print a full repository listing of all files, remove the directories which confuse blame, run svn blame on each individual file, and tally the resulting line counts. It seems quite slow, depending on your repository location, because blame must hit the server for each individual file. You can remove the -R on the first part to print out the tallies for just the current 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: