Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Why does my server show

            total      used      free   shared buffers    cached
    Mem: 12286456  11715372    571084        0   81912   6545228
-/+ buffers/cache:  5088232   7198224
   Swap: 24571408     54528  24516880

I have no idea on calculating the memory in linux. I think it says that 5088232 is used where as 7198224 is free, meaning it is actually consuming 5GB of RAM?

share|improve this question
2  

3 Answers 3

up vote 98 down vote accepted

The first line means:

  • total: Your total (physical) RAM (excluding a small bit that the kernel permanently reserves for itself at startup); that's why it shows ca. 11.7 GiB , and not 12 GiB, which you probably have.
  • used: memory in use by the OS.
  • free: memory not in use.

total = used + free

  • shared / buffers / cached: This shows memory usage for specific purposes, these values are included in the value for used.

The second line gives first line values adjusted. It gives the original value for used minus the sum buffers+cached and the original value for free plus the sum buffers+cached, hence its title. These new values are often more meaningful than those of first line.

The last line (Swap:) gives information about swap space usage (i.e. memory contents that have been temporarily moved to disk).

To actually understand what the numbers mean, you need a bit of background about the virtual memory (VM) subsystem in Linux. Just a short version: Linux (like most modern OS) will always try to use free RAM for caching stuff, so Mem: free will almost always be very low. Therefore the line -/+ buffers/cache: is shown, because it shows how much memory is free when ignoring caches; caches will be freed automatically if memory gets scarce, so they do not really matter.

A Linux system is really low on memory if the free value in -/+ buffers/cache: line gets low.

For more details about the meaning of the numbers, see e.g. the questions:

share|improve this answer
5  
+1 Great answer. –  Willie Wheeler Nov 25 '09 at 4:29

For anyone needing an even more simple, step-by-step explanation, check http://thoughtsbyclayg.blogspot.com/2008/09/display-free-memory-on-linux-ubuntu.html, his explanation helped me a lot.

share|improve this answer

The buffers/cache line shows you how much memory is used by programs (first of those columns), and is free for programs to use (second column). It's a fairly esoteric number, and not something you'd really look at much in practice.

share|improve this answer
    
And what does the first line (mem line) means –  Muahmmad Zeeshan Nov 17 '09 at 11:14
6  
That you've got 12GB of RAM installed in the system, 11.5GB of which is used and 0.5GB or so is currently unused. Approximately 82MB of the used memory is used for buffers (network connections, etc), whilst about 6.5GB is being used to store copies of data on disk, so that data won't have to be re-read if it's needed again. –  womble Nov 17 '09 at 11:33
    
Let me just summarize what i understood. server have 12GB of ram installed. off which first line shows 11.5GB is used. 82MB is free. Second line shows 4.8GB is used by programs. and 6.86GB is being used to copy disk data (second row second column). Now it all means that the system has reached its limits and we have to install more memory? –  Muahmmad Zeeshan Nov 17 '09 at 11:43
3  
@Muhammad: "82MB is free." - no, 57MiB is free (but that doesn't really matter, see my answer). "Now it all means that the system has reached its limits" - No, not at all. The system has 6.9GiB in use for caching, which it will readily give to applications, so there's lots of room. Also, swap usage is very low (ony ca. 50MiB). If memory starts getting tight, swap usage will rise. At present you're barely using half the RAM you have. –  sleske Nov 17 '09 at 11:50
3  
Have you considered asking a new question at some point? –  womble Nov 17 '09 at 13:27

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.