Server Fault is a question and answer site for system and network administrators. 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 have a mysql server running debian with 2GO of RAM. I would like to know the amount of memory used by each process.

I thought ps -aux was the command and options for it. But I only see 90 MO used by several processes and free -m tells me that 1400 MO are used.

Is there a way to have a better view with the processes and the memory used by them ?

srv-datax:~# free -m
             total       used       free     shared    buffers     cached
Mem:          2015       1476        539          0          0         70
-/+ buffers/cache:       1405        609
Swap:          486          0        486
share|improve this question

is a good option

#top -H

lets you monitor all Threads

#top -U root

this kind of using '-U' switch lets you monitor user-specific listing

share|improve this answer

You should post your free output so we know you are reading is correctly. Memory usage on Linux for a process is hard to nail down specifically, if you really want to get into the details and have a recent kernel, check cat /proc/<pid>/smaps.

share|improve this answer

Top does a good job, look for these headers:

share|improve this answer
srv-datax:~# free -m total used free shared buffers cached Mem: 2015 1476 539 0 0 70 -/+ buffers/cache: 1405 609 Swap: 486 0 486 – tuxsmouf May 25 '10 at 13:30

Another option along the same lines as what AbhishekKr suggested: ps aux will give you a breakdown of the memory used by every process on the system.

VSZ => Virtual Size (physical RAM+swap used), RSS => Resident Size (physical RAM only).
The %MEM column reflects the % of physical RAM used if memory serves, I'm sure someone will correct me if I'm wrong :)

share|improve this answer
The problem is those are kind of messed up, they don't properly account for shared memory, so if you have a bunch of instances of a program, it will show that memory over and over again. The end result being that summed RSS overestimates memory. – Kyle Brandt May 25 '10 at 18:24
For example: ps -A -o rss,cmd | grep oracle | awk '{print $1}' | (tr '\n' '+'; echo 0) | bc returns 12733324, where as free -buffers/cache is 1741736 – Kyle Brandt May 25 '10 at 18:28
That's true: ps includes shared memory in RSZ. If you're summing up the data this can lead to over-counting, but it's still a good indicator of rough size for a single process if you don't mind that fuzz. If you want to exclude shared pages top's output is probably better as it lists shared memory separately. – voretaq7 May 25 '10 at 19:03

Adding to what Kyle Brandt suggested, you could use the Tool pmap which nicely summarizes the information found in /proc/<pid>/smap. If you use the -d option, it will show you how much memory is mapped, shared and set private. This, IMHO, provides a good view.

I can also suggest reading this interesting article about memory usage.

share|improve this answer

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.