[Grml-devel] submitting script for review: counting per process swap usage

Mulyadi Santosa mulyadi.santosa at gmail.com
Tue Jan 31 09:19:29 CET 2012


Hi all

This is my first contribution toward Grml. I have written a shell
script that utilize Linux kernel provided statistic to account per
process swap usage. Here it is:

for a in /proc/[0-9]*
    do strings $a/cmdline; # output the name of the process
    echo ;
    grep Swap $a/smaps |  awk '{ SUM += $2 } END { print SUM }';  #
swap usage in kilobytes
    echo ----------------;
done

Thank you for your help and looking forward for opinions. I hope this
little script could transform into "grml-" specific script.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com


More information about the Grml-devel mailing list