Last active
January 4, 2016 13:39
-
-
Save netmarkjp/8629342 to your computer and use it in GitHub Desktop.
process raking one liner / swap used
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
echo "SWAP used, PID, cmdline"; (ls /proc/[0-9]*/smaps | while read line; do PID=$(echo $line | cut -d / -f 3) ; SWAP=$(cat $line 2>/dev/null| grep -i swap | awk 'BEGIN{sum=0}{sum+=$2}END{print sum}') ; if [ $SWAP -ne 0 ] ; then echo "$SWAP kB, $PID", `cat /proc/$PID/cmdline` ; fi ; done ) | sort -nr -k1 | head |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output example.
SWAP used, PID, cmdline
4296 kB, 20652, /opt/dell/srvadmin/sbin/dsm_sa_datamgrd
2588 kB, 14505, /opt/dell/srvadmin/sbin/dsm_om_shrsvcd
2408 kB, 2888, /usr/sbin/snmpd-LS0-6d-Lf/dev/null-p/var/run/snmpd.pid
1368 kB, 20978, /opt/dell/srvadmin/sbin/dsm_sa_snmpd
924 kB, 28683, sshd: admin [priv]
912 kB, 4961, sshd: admin [priv]
904 kB, 3439, sshd: admin [priv]
904 kB, 28836, sshd: admin [priv]
900 kB, 5285, sshd: admin [priv]
896 kB, 28981, sshd: admin [priv]