Check which processes are eating swap on Linux?

Solution 1:

  1. Run top
  2. Press f to select displayed fields
  3. Navigate down to SWAP using arrow keys
  4. Hit Space - SWAP will become preceded by asterisk *
  5. Press right arrow key - this will allow you to move SWAP to a convenient place in the listing, for example between %MEM and TIME+
  6. Press q to return to top view

Step 5 isn't necessary, just convenience - without it SWAP will be showing up as the last entry of the list, after COMMAND.

Solution 2:

You can use smem command line tool.

smem manpages:

Memory can be reported by process, by user, by mapping,
or systemwide. Both text mode and graphical output are available.

smem memory reporting tool