Become root
Code: Select all
cd /proc
for i in *
do
if [[ $i =~ ^[0-9]+$ ]]
then
SWAP=`pmap -x $i | grep ^total | awk '{ print $3; }'`
[ "xx$SWAP" != "xx" ] && echo "$SWAP kB for PID $i"
fi
done | sort -n | tail -20
RHEL 7
Become root
Code: Select all
cd /proc
for i in *
do
if [[ "$i" =~ ^[0-9]+$ ]]
then
SWAP=`pmap $i | grep total | awk '{ print $2}'`
if [[ "$SWAP" != "" ]]
then
Size=`echo $SWAP | cut -dK -f1`
if [[ "$SWAP" != "0K" ]]
then
echo "$Size KB memory used by PID $i"
fi
fi
fi
done | sort -n
Code: Select all
cd /proc
for i in *
do
if [[ "$i" =~ ^[0-9]+$ ]]
then
SWAP=`grep VmSwap $i/status | awk '{print $2}'`
if [[ "$SWAP" != "0" ]]
then
if [[ "$SWAP" != "" ]]
then
echo "$SWAP KB swap used by PID $i"
fi
fi
fi
done | sort -n