Ask Your Question

Question on free command

asked 2018-01-12 02:11:02 -0500

kraljic37 gravatar image

I have two questions on Linux's free command. Below, I have provided output from my home laptop (fedora 26 ) which has 16GB Physical RAM and an enterprise production server (RHEL 7.4) which has 24GB RAM.

Question1. What exactly does the buffer/cache column say in free command's output ? buffer/cache is only 1GB in my home laptop but it is 18GB in production server below.

Question2. To know the free RAM available to the system, Can I trust the 'available' column rather than the 'free' column ? In my home laptop, the 'free' column shows 13GB and available shows 14GB But, in my production server, when the free command shows just 2GB , the available command shows 9 GB

free command's output from my Dell Home Laptop with 16 GB RAM (Fedora 26)

[sysadmin@johnspc ~]$ cat /etc/redhat-release
Fedora release 26 (Twenty Six)
[sysadmin@johnspc ~]$
[sysadmin@johnspc ~]$ uname -a
Linux johnspc 4.12.8-300.fc26.x86_64 #1 SMP Thu Aug 17 15:30:20 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[sysadmin@johnspc ~]$
[sysadmin@johnspc ~]$ free -h
              total        used        free      shared  buff/cache   available
Mem:            15G        854M         13G        385M        1.0G         14G
Swap:          7.8G          0B        7.8G
[sysadmin@johnspc ~]$
[sysadmin@johnspc ~]$ free -m
              total        used        free      shared  buff/cache   available
Mem:          15939         854       14073         385        1011       14362
Swap:          8034           0        8034
[sysadmin@johnspc ~]$

A production Server (VM) with 24GB RAM (RHEL 7.4)

[root@hewdbprod218 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)
[root@hewdbprod218 ~]#
[root@hewdbprod218 ~]# uname -a
Linux hewdbprod218 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 13 10:46:25 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@hewdbprod218 ~]#
[root@hewdbprod218 ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:            23G        3.3G        2.0G         10G         18G        9.0G
Swap:          2.0G        1.4G        674M
[root@hewdbprod218 ~]#
[root@hewdbprod218 ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:          23948        3471        2002       11006       18473        9194
Swap:          2063        1389         674
[root@hewdbprod218 ~]#
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2018-01-12 10:05:14 -0500

Petr Menšík gravatar image

Buff/cache means cached pages from disk into memory for higher system speed. It is cache of contents from disk loaded into RAM. When program requests reading of file already in cache, its contents is served from RAM. It does not have to wait each time until it is read from disk. Loading times for SSD are close to acessing RAM, so this will not make huge difference. Available is described in manual page:

          Estimation of how much memory  is  available  for  starting  new
          applications,  without swapping. Unlike the data provided by the
          cache or free fields, this field takes into account  page  cache
          and also that not all reclaimable memory slabs will be reclaimed
          due to items being in use (MemAvailable in /proc/meminfo, avail‐
          able on kernels 3.14, emulated on kernels 2.6.27+, otherwise the
          same as free)

Difference between free and available is that free is not used for anything useful. Available includes cache parts, that can be freed if more memory is required. Buff will fill with IO operations of running system. It will load contents into RAM for higher speed. Because your server is more busy and longer running than your desktop, it already has full cache. That is ok, free memory is wasted memory.

edit flag offensive delete link more

answered 2018-01-14 22:58:22 -0500

kraljic37 gravatar image

Thank You Petr So, when a new process is spawned or an existing process needs extra memory , will the memory be allocated from 'free' (100% unused) or Cache+Buffer allocation ?

edit flag offensive delete link more


It definitely should use free memory before swapping allocated buffers. But I am not kernel people to confirm that.

Petr Menšík gravatar imagePetr Menšík ( 2018-01-29 11:31:14 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-01-12 02:11:02 -0500

Seen: 70 times

Last updated: Jan 12