Categories: Process

Free Linux command (memory usage) [Basic Guide]

Free Linux command shows the amount of total memory in use and available, as well as cache and swap information.

The “-b”, “-k” and “-m” options show the amount in bytes, kbytes, and megabytes respectively:

$ free 
total used free shared buff/cache available 
Mem: 2039524 189396 178424 131684 1671704 1503316 
Swap: 0 0 0

The -h option shows the quantities in an easier to read way:

$ free -h 
total used free shared buff/cache available 
Mem: 1.9G 153M 205M 128M 1.6G 1.5G 
Swap: 0B  0B 0B

Below is the meaning of each field:

  • total: Total RAM installed in the system;
  • used: Memory used (total – free – buffers – cache);
  • free: Available memory;
  • shared: Memory shared between processes using tmpfs. Processes can allocate memory that they share, for example, with their child processes;
  • buffers: Memory used as a clipboard by the kernel;
  • cache: Memory used by the cache of memory pages;
  • available memory regardless of the memory used in buffers and caching

In old versions of the free command, buffer and cache information were separated into two columns, because Linux divided the buffer cache into two categories. The buffer was the memory used by the Kernel, and the Cache was the memory used by processes for caching. It was decided to combine this information in a single column.

The free command also shows the amount of memory available and used in swap.

Swap is a disk area that can be used as a space for exchanging memory pages between RAM and disk, making it possible to virtually increase system memory through pagination between memory and disk. It is a feature that can be used to avoid running out of RAM memory.

If the system makes extensive use of Swap, it is a strong indication that there is a need to increase the amount of RAM depending on the use of the system.

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Share
Published by
Uirá Endy Ribeiro

Recent Posts

Sudo command on Linux (privilege scale) [Basic Guide]

The sudo command on Linux executes a given command as if it were another user.…

2 years ago

SS command on Linux (investigate the network) [Basic Guide]

The ss command on Linux is extremely useful for investigating sockets, providing various information about…

2 years ago

Linux while command (loop – while) [Basic Guide]

The shell has structures for testing conditions and executing certain program sequences several times (loop),…

2 years ago

Linux fstab file (disk mount setup) [Basic Guide]

The /etc/fstab file stores the configuration of which devices should be mounted and what is…

2 years ago

Netcat command on Linux (Swiss network knife) [Basic Guide]

The Netcat Command in Linux or nc is a utility used to do “almost anything”…

2 years ago

Linux gdisk command (partitioning disk) [Basic Guide]

The gdisk command in Linux is similar to fdisk and allows you to manipulate and…

2 years ago

This website uses cookies.