linuxmemory

How to find out which processes are using swap space in Linux?


Under Linux, how do I find out which process is using the swap space more?


Solution

  • Run top then press OpEnter. Now processes should be sorted by their swap usage.

    Here is an update as my original answer does not provide an exact answer to the problem as pointed out in the comments. From the htop FAQ:

    It is not possible to get the exact size of used swap space of a process. Top fakes this information by making SWAP = VIRT - RES, but that is not a good metric, because other stuff such as video memory counts on VIRT as well (for example: top says my X process is using 81M of swap, but it also reports my system as a whole is using only 2M of swap. Therefore, I will not add a similar Swap column to htop because I don't know a reliable way to get this information (actually, I don't think it's possible to get an exact number, because of shared pages).