Created
September 17, 2012 21:51
-
-
Save miend/3740013 to your computer and use it in GitHub Desktop.
Logos's handy functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ipprint(){ LST=$@ ; ( [ -e "$LST" ] && cat $LST ; [ ! -e "$LST" ] && for i in $LST ; do echo $i ; done ) | while read host ; do echo -en "$host:\t$(dig +short $host.fqdn.com )\n" ; done ; } | |
# Takes a string of arbitrary length of servers on your intranet and lists them colon-and-tab delimited next to their IP addresses | |
function ksmtop(){ (cd /sys/kernel/mm/ksm/ ; while true ; do date ; for i in `ls` ; do printf "%-20s %-20s\n" $i `cat $i` ; done ; sleep 2 ; clear ; done) ; } | |
# Does top-like output for a server's KSM metrics (RAM deduplication in KVM) | |
function inpath(){ for item in $@ ; do echo $PATH | awk -F':' '{ for (i=2 ; i<=NF ; i++) print $i ; }' | while read line ; do ls $line | grep $item ; done ; done ; } | |
# Takes a partial string and reports what commands are currently in your $PATH that are successful matches to it | |
function du_by_size(){ du -ks * | sort -nr | cut -f2 | xargs du -hs ; } | |
# Prints in human readable format the disk usage sizes from largest to smallest of your current working directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment