January 11

find which service is using a SWAP

one line search:

for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less

source: cyberciti.biz

2025 version, a bit tuned by me:

echo -e "NAME:\t\t PID:\t SWAP(kB):";for file in /proc/*/status ; do grep -w "VmSwap:\|Name:\|Pid:" $file|awk '/VmSwap|Name|Pid/{printf $2 " " $3}END{ print ""}';done|sort -k 3 -n -r|head -n 20|column -t


Copyright 2021. All rights reserved.

Posted 11 January 2019 by admin in category "simple memo

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.