How to read ram parameters via free command

To see the amount of RAM used we have many different commands such as:

free -m (Tính dung lượng theo MB)
free (Tính dung lượng theo KB)

cat /proc/meminfo


vmstat -s

For example, an example of the free command:

free -m

               total     used      free      shared      buff/cache      available
Mem:     1838     553      494         11        789          1074
Swap:      4095     0       4095

  1. total Displays the total amount of RAM available.

  2. used Display RAM used.

  3. free Show available ram.

  4. shared Displays the ram used for the ramdisk service

  5. buffers show the ram used by kernel buffers.

  6. cached Ram used by page cache and slabs (Cached and Slab available in / proc / meminfo).

  7. buffers / cache Show total buffers and cache sizes.

Thực tế thì: Total = used + free + buff/cache.

However, the MemFree parameter returned is not the amount of free system memory.

Because Total memory in Linux is calculated by Active memory + Inactive memory (not including Swap). The problem is that Inactive memory, which is the memory when we run a process and turn it off, the system will cache this memory so that when we call this process again, it will use this inactive memory immediately instead of having to allocate it. replay. So when we open more and more processes, then turn it off, the more inactive memory takes up (Linux's Disk Caching technique)

When opening a new process, if the system lacks RAM, Linux will automatically switch the Inactive memory to Swap and dedicate all memory to the active process. As such, the system is not overloaded.

Conclusion, a sign to identify whether the system is short of RAM or not is to look at Swap, if Swap uses a lot of RAM, it is necessary to upgrade the memory for VPS / Server.

In the absence of a swap, please use the command free -h and look at the line-/+ buffers/cache to see how much memory the system is actually free.

For CentOS 6

The system has a total of 996MB RAM, used 193MB (19.37%) and had 802MB available. The 2GB swap hasn't been used yet.

For CentOS 7


The system has a total of 488MB RAM, with actual usage is only 125MB. 6MB and 357MB left available (used as buff / cache). Unused 1GB swap. What you need to be concerned about is the actual amount of free RAM that applications can use (available) - 286MB

Thus, the signal to worry about is when:

  • Available memory or free of - / + buffers / cache goes to 0

  • Swap usage increases

In case there are signs of using too much ram, you should check the service again or plan to upgrade the Ram to your VPS. For linux operating systems, the recommended level for any VPS to run website services should be at least 2GB.



seo marketing wordpress seo seo hosting seo and marketing word press seo wordpress and seo wordpress marketing hosting seo seo press pro market seo seo & marketing seo e marketing e marketing seo seo pro wordpress marketing & seo seo di wordpress wordpress seo host hosting and seo wordpress hosting seo wordpress seo wordpress wordpress for marketing seo press wordpress marketing for seo