Super User is a question and answer site for computer enthusiasts and power users. 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

Possible Duplicate:
How can I display the memory usage of each process if i do a 'ps -ef'

For example, how can I find the top 20 processes that occupy the most memory?

My Linux system is going to run out of memory...

How can I find the processes which I can kill, in order to have enough memory to keep my Linux safely up and running?

[mirror@home tmp]$ free -m
             total       used       free     shared    buffers     cached
Mem:          1024        741        282          0          0          0
-/+ buffers/cache:        741        282
Swap:            0          0          0    // no swap is enable on openvz machine;(
share|improve this question

marked as duplicate by soandos, Keltari, avirk, Indrek, 8088 Sep 5 '12 at 15:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 4 down vote accepted

top is a tool in linux that shows top processes running, including memory consumption. Open a terminal and give top -c. This will show the processes in random order. To arrange it in order of top processes type shift+p and in order of memory type shift+m. You can find the process id's of processes running by looking at the table. If you want to kill a process press k and give the process id to kill it. Here is a quick read on top

At this same time, if you run this command in a new terminal

watch -n 2 `free -m`` (remove the last quote when you run the command, sorry i just can't get the formatting right here)

you can see real time changes in memory as you work along top command, and if it is freeing up memory. This updates memory stats every two seconds.

share|improve this answer
top can only show the percentage of memory, can i configure to let it show memory in mb? – hugemeow Sep 5 '12 at 5:48
there is a field/column in top command that shows virtual, swap and physical memory in kb. Here is the man page and look at section 2a, lines o,p and q. You will need to customize top to get that columns shown. But its worth it, no tool is as powerful as top in linux. imho. – paintbox Sep 5 '12 at 12:44

Not the answer you're looking for? Browse other questions tagged .