top command to list  processes using swap on linux

Posted on 2011-09-19
Medium Priority
Last Modified: 2012-05-12

I want to pull swap usage per process on linux 2.6+,  I see that the I can use run top then press 'f' then 'p' to get swap information.. the problem is that it is interactive.   Is there a command line for top to just spit out swap information that is also sorted by swap?

the reason is I want to take that information and put it in a script.


Question by:phatbrain101
  • 2
LVL 23

Expert Comment

ID: 36563548
There's no single command in Linux that does this.  It's really hard to determine because some things get put in/out of swap very quickly (I know you're most likely looking for "big pigs" that take up a lot of swap)

Hmm... maybe the shell script on this page will be of some help to you:

Author Comment

ID: 36564095
that actually does not report the swap information as accurately as top then p option for swap.  top showed swap being used while that script kept reporting 0 swap usage.
LVL 38

Accepted Solution

wesly_chen earned 750 total points
ID: 36570752
Which Linux distribution do you have?
You can install
iotop  (available for Ubuntu and EPEL repository in CentOS/RHEL).
  Then you can see the "SWAPIN" percentage for each process.

Here is the homepage of iotop

Author Closing Comment

ID: 37497706
partially answered my question, but still dont have a solid solution

Featured Post

We Need Your Input!

WatchGuard is currently running a beta program for our new macOS Host Sensor for our Threat Detection and Response service. We're looking for more macOS users to help provide insight and feedback to help us make the product even better. Please sign up for our beta program today!

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.

Join & Write a Comment

The Internet has made sending and receiving information online a breeze. But there is also the threat of unauthorized viewing, data tampering, and phoney messages. Surprisingly, a lot of business owners do not fully understand how to use security t…
Phishing emails are a popular malware delivery vehicle for attack.  While there are many ways for an attacker to increase the chances of success for their phishing emails, one of the most effective methods involves spoofing the message to appear to …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question