Determining a server's memory usage
Learn how to check memory usage statistics on a server using the free command.

This article explains how to determine memory usage on a server with the free command.

Using the free command
To check memory usage statistics on a server, follow these steps:

  1. Log in to the server via SSH.

  2. At the command prompt, run the following command:

free -m
Note
For easier reading, use the -m option to display memory statistics in megabytes. To see the statistics in bytes, run free without the -m option.

Interpreting the free command output
For example, consider this sample output from a server:

root@example.com:~# free -m
             total      used      free    shared   buffers    cached
Mem:          2003      1338       665         0       149      1015
-/+ buffers/cache:       172      1830
Swap:            0         0         0

At first glance, you might assume the server is using 1338 MB of RAM and has 665 MB free. However, the actual memory in use is 172 MB, and 1830 MB is available for applications.

Linux uses free memory for disk caching to improve performance. Memory shown in the buffers and cached columns is available immediately for applications, even though it appears as "used." By adding free memory (665 MB), buffers (149 MB), and cached memory (1015 MB), the total available memory is 1829 MB. The slight difference from the 1830 MB shown is due to rounding when using the -m option. Using free without -m (bytes) will give exact numbers.

Tip
On newer Linux versions, it’s easier to see available memory for applications because the free command includes an available column. For example:

              total        used        free      shared  buff/cache   available
Mem:           7882        2465        2278         666        3138        4458
Swap:             0           0           0

In this case, 4458 MB of memory is available for applications.

More information
For a humorous explanation of Linux memory usage, visit Linux Ate My RAM.

?האם התשובה שקיבלתם הייתה מועילה 0 משתמשים שמצאו מאמר זה מועיל (0 הצבעות)

Powered by WHMCompleteSolution