Commands by drockney (3)

  • Find all private keys and dump their fingerprints. Show Sample Output

    for id in `ls -1 ~/.ssh | grep -v "authorized\|known_hosts\|config\|\."` ; do echo -n "$id: " ; ssh-keygen -l -f .ssh/$id ; done
    drockney · 2014-04-16 14:12:20 4
  • Automatically drops mount points that have non-numeric sizes (e.g. /proc). Tested in bash on Linux and AIX. Show Sample Output

    for m in `df -P | awk -F ' ' '{print $NF}' | sed -e "1d"`;do n=`df -P | grep "$m$" | awk -F ' ' '{print $5}' | cut -d% -f1`;i=0;if [[ $n =~ ^-?[0-9]+$ ]];then printf '%-25s' $m;while [ $i -lt $n ];do echo -n '=';let "i=$i+1";done;echo " $n";fi;done
    drockney · 2013-07-29 20:12:39 0
  • Tested in bash on AIX & Linux, used for WAS versions 6.0 & up. Sorts by node name. Useful when you have vertically-stacked instances of WAS/Portal. Cuts out all the classpath/optional parameter clutter that makes a simple "ps -ef | grep java" so difficult to sort through. Show Sample Output

    ps -ef | grep [j]ava | awk -F ' ' ' { print $1," ",$2,"\t",$(NF-2),"\t",$(NF-1),"\t",$NF } ' | sort -k4
    drockney · 2012-01-05 16:05:48 0

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

run command on a group of nodes in parallel redirecting outputs
Do the same as pssh, just in shell syntax. Put your hosts in hostlist, one per line. Command outputs are gathered in output and error directories.

phpinfo from the command line

Show the UUID of a filesystem or partition
Show the UUID-based alternate device names of ZEVO-related partitions on Darwin/OS X. Adapted from the lines by dbrady at and following the disk device naming scheme at

Recover resolution when a fullscreen program crashes and you're stuck with a tiny X resolution
This forces X back to its maximum resolution configured. To get a list, type `xrandr'.

Show device drivers and their properties (Windows XP)
Show device drivers and their properties, including digital signatures /si and in table format /fo.

remove all spaces from all files in current folder

Remove leading zeros in multiple columns with sed
Leading zeros might help correct sorting and they can be removed by sed after sorting

Load file into RAM (cache) for faster accessing for repeated usage
Best result when file size less than half of RAM size

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

fast access to any of your favorite directory.
example: -------------------------------------------------------------------------------------------- user@ubuntu:~/workspace/SVN/haystak-repos/trunk/internal/src$ addpi -------------------------------------------------------------------------------------------- Now that directory is in the list of fast access directories. You can switch to it anytime like this: -------------------------------------------------------------------------------------------- user@ubuntu:~$ pi internal` user@ubuntu:~/workspace/SVN/haystak-repos/trunk/internal/src$ -------------------------------------------------------------------------------------------- Please note the backquote ( the symbol that shares its key with ~ in the keyboard ) pi will switch you to that directory. To see the list of all fast access directories you have to say "cat ~/.pi"

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: