LINUX: What processes are using SWAP?

Hi,

How can I see what processes are resident in swap? I'd like to see what application is using my swap.

Thank you.
LVL 1
g0allAsked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
Hi, and Happy New Year!

You could try

ps -e -o rss,vsize,pid,cmd

This will display, besides PID and command, the resident set sizes (main memory) and the total virtual memory sizes of your processes.

The difference between the resident size and total size is the swap space used by that process.

One-liner to calculate that difference (sorted ascending by swap size):

ps -e -o rss,vsize,pid,cmd |awk '{SW=$2-$1; print SW, $0}' |sort -k1n

If "cmd" prints the full command line try "comm" instead to see just the executable's name.
0
 
g0allAuthor Commented:
Happy New Year wmp!

Thank you for your answer! I will check this and revert back later.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.