Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 great question!!! thank you! – mongotop May 9 '13 at 18:49
up vote 59 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
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
I had to press s to sort by %MEM and, then hit escape for top. – Bryce Guinta Jun 26 at 20:40

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
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

This command will identify the top memory consuming processes:

ps -A --sort --rss -o pid ,pmem:40,cmd:500 | head -n 6 | tr -s" " ";"
share|improve this answer
The command doesn't even run. – Kinderchocolate Jun 28 at 0:54

Your Answer


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.