Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm looking for somthing like top is to CPU usage. Is there a command line argument for top that does this? Currently, my memory is so full that even 'man top' fails with out of memory :)

share|improve this question
1  
+1 great question!!! thank you! –  mongotop May 9 '13 at 18:49
    

5 Answers 5

up vote 21 down vote accepted

From inside top you can try the following:

  • Press SHIFT+f
  • Press the Letter corresponding to %MEM
  • Press ENTER

You might also try:

$ ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -5

This will give the top 5 processes by memory usage.

share|improve this answer
5  
Under Linux, simply press M to sort by physical memory usage (RES column). Under *BSD, run top -o res or top -o size. But htop is a lot nicer and doesn't even consume more memory than top (however it's not part of the basic toolset so you might not have it installed). –  Gilles Dec 19 '10 at 13:38

If you have it installed I like htop once launching it you can press f6, down arrow (to MEM%), enter to sort by memory.

share|improve this answer

Once top starts, press F to switch to the sort field screen. Choose one of the fields listed by pressing the key listed on the left; you probably want N for MEM%

share|improve this answer
2  
If you want MEM%, pressing 'M' does the same stated above. 'c' adds command line parameters to the process list, may be informative for your problem. –  wag Dec 19 '10 at 8:46
    
@wag Oh, handy. –  Michael Mrozek Dec 19 '10 at 9:25

In Solaris the command you would need is:

prstat -a -s size

This will list all processes in order of descending process image size. Note that the latter is based on memory committed to the process by the OS, not its resident physical memory usage.

There are supposedly versions of "top" available for Solaris, but these are not part of the standard installation.

share|improve this answer

One nice alternative to top is htop. Check it, it is much more user friendly than regular top.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.