Memory please

If you run a lot of Linux systems, you might have noticed that they sometimes run slowly. If your systems are slow, that means your business could suffer, so you’ll want to find out why that is happening. Let’s say you decide to first check whether you have enough memory.

Are you using 10% of your memory?
Source: Wikipedia

Free your mind

To check your memory on Linux, use the free command. For example:

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           926M         41M        542M        6.2M        341M        814M
Swap:           99M        512K         99M

We used -h to make the output easier to read as a human. According to the available column, this system has 926 MB of memory, and 814 MB free. There’s plenty of memory available!

Free your old mind

If you are running an older system, be careful! There is no available column, which might give you the impression that you have far less memory than you think. For example:

$ free -m
             total       used       free     shared    buffers     cached
Mem:           995        821        173          0         31        668
-/+ buffers/cache:        122        873
Swap:         1023          0       1023

Notice we had to use -m for megabytes, instead of -h. Also notice that free shows 173 MB on the first line, and 873 MB on the second line. The second line is the same as available on newer systems. Thus, this system also has plenty of memory available!