Check the memory status of the server with the Linux free command

environment

[root@CENTOS7 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
[root@CENTOS7 ~]#

1. How to read the output of the free command

You can check the memory status in the system with the free command. The output result is as follows.

output result of free command


[root@CENTOS7 ~]# free
              total        used        free      shared  buff/cache   available
Mem:        1014820      184368      684116        6928      146336      683684
Swap:       1679356           0     1679356
[root@CENTOS7 ~]#

Each item is as follows.

item Contents
total Total memory amount
used Memory usage (memory actually used by the process)
free Unallocated memory amount that is not used at all
shared Amount of memory used in shared memory
buff/cache Amount of memory used for file buffer + cache memory
available Amount of memory available to the process

** Added on 2020/03/13 **

Notes


2. options for the free command

Short option Long option Contents
-b --bytes Display memory amount in bytes
-k --kilo Display memory amount in kilobytes
-m --mega Display memory amount in megabytes
-g --giga Display the amount of memory in gigabytes
--tera Display the amount of memory in terabytes
--peta Display memory amount in petabytes
-h --human Displayed in easy-to-read units
-w --wide Display in wide mode
-c times --count times Specify the number of times to output (default is to output once and finish)
-l --lohi Show low memory and high memory status
Low memory: Area used by the Linux kernel
High memory: Memory area used by the process
-s interval --seconds interval Output interval is "ss".Specified by "tt seconds" (default is output once and finished)
--si Calculated by dividing by 1000 instead of 1024 when converting units
-t --total Show row showing total physical and swap memory

reference

Man command manual (English)

FREE(1)                          User Commands                         FREE(1)



NAME
       free - Display amount of free and used memory in the system

SYNOPSIS
       free [options]

DESCRIPTION
       free  displays the total amount of free and used physical and swap mem‐
       ory in the system, as well as the buffers and caches used by  the  ker‐
       nel.  The  information  is  gathered by parsing /proc/meminfo. The dis‐
       played columns are:

       total  Total installed memory (MemTotal and SwapTotal in /proc/meminfo)

       used   Used memory (calculated as total - free - buffers - cache)

       free   Unused memory (MemFree and SwapFree in /proc/meminfo)

       shared Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available
              on kernels 2.6.32, displayed as zero if not available)

       buffers
              Memory used by kernel buffers (Buffers in /proc/meminfo)

       cache  Memory used by the page cache and slabs (Cached and SReclaimable
              in /proc/meminfo)

       buff/cache
              Sum of buffers and cache

       available
              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)

OPTIONS
       -b, --bytes
              Display the amount of memory in bytes.

       -k, --kilo
              Display the amount of memory in kilobytes.  This is the default.

       -m, --mega
              Display the amount of memory in megabytes.

       -g, --giga
              Display the amount of memory in gigabytes.

       --tera Display the amount of memory in terabytes.

       --peta Display the amount of memory in petabytes.

       -h, --human
              Show all output fields automatically scaled  to  shortest  three
              digit  unit and display the units of print out.  Following units
              are used.

                B = bytes
                K = kilos
                M = megas
                G = gigas
                T = teras
                P = petas

              If unit is missing, and you have exabyte of  RAM  or  swap,  the
              number  is  in  terabytes  and columns might not be aligned with
              header.

       -w, --wide
              Switch to the wide mode. The wide  mode  produces  lines  longer
              than  80 characters. In this mode buffers and cache are reported
              in two separate columns.

       -c, --count count
              Display the result count times.  Requires the -s option.

       -l, --lohi
              Show detailed low and high memory statistics.

       -s, --seconds seconds
              Continuously display the result delay seconds  apart.   You  may
              actually  specify any floating point number for delay, usleep(3)
              is used for microsecond resolution delay times.

       --si   Use power of 1000 not 1024.

       -t, --total
              Display a line showing the column totals.

       --help Print help.

       -V, --version
              Display version information.

FILES
       /proc/meminfo
              memory information

SEE ALSO
       ps(1), slabtop(1), top(1), vmstat(8).

AUTHORS
       Written by Brian Edmonds.

REPORTING BUGS
       Please send bug reports to [email protected]?



procps-ng                          July 2014                           FREE(1)

Man command manual (Japanese) (google translate)

FREE(1)                          User Commands                         FREE(1)



NAME
       free -Show the amount of free and used memory on your system


SYNOPSIS
       free [options]

DESCRIPTION
free is the total amount of free and used physical and swap memory in the system,
And displays the buffers and caches used by the kernel.
The information is "/proc/It is collected by analyzing "meminfo".
The columns displayed are:
       
total Total installed memory ("/proc/"MemTotal" and "SwapTotal" in meminfo)

used used memory ("total"- free - buffers -Calculated as "cache")

free unused memory ("/proc/"Mem Free" and "Swap Free" in meminfo)

shared (mainly) memory used by tmpfs (""/proc/"Shmem" in "meminfo", kernel 2.6.Available at 32, displayed as zero if not available)

       buffers
Memory used by the kernel buffer ("/proc/"Buffers" in "meminfo")

cache Memory used by page cache and slab ("/proc/"Cached" and "SReclaimable" in meminfo)

       buff/cache
Buffer and cache sum

       available
Estimate the amount of memory available to start a new application without swapping.
Unlike the data provided by the cache or free fields
This field takes into account the page cache and for items in use
Not all recoverable memory slabs will be recovered
              (「/proc/"MemAvailable" of "meminfo", kernel 3.Available at 14,
Emulated kernel 2.6.After 27, other than that, it is the same as free)
OPTIONS
       -b, --bytes
Displays the amount of memory in bytes.

       -k, --kilo
Displays the amount of memory in kilobytes. This is the default.

       -m, --mega
Displays the amount of memory in megabytes.

       -g, --giga
Displays the amount of memory in gigabytes.

       --tera Displays the amount of memory in terabytes.

       --peta Displays the amount of memory in petabytes.

       -h, --human
Shows all output fields that are automatically scaled to a minimum of 3 digits
Displays the print unit. The following units are used.

                B = bytes
                K = kilos
                M = megas
                G = gigas
                T = teras
                P = petas

If you don't have a unit and you have exabytes of RAM or swap
The numbers are in terabytes and the columns may not be aligned with the headers.

       -w, --wide
Switch to wide mode. Wide mode produces lines longer than 80 characters.
In this mode, the buffer and cache are reported in two separate columns.

       -c, --count count
Displays the number of counts of the result.-Requires the s option.

       -l, --lohi
View detailed low and high memory statistics.

       -s, --seconds seconds
Continuously displays the result delay in seconds.
You can actually specify any floating point number for the delay.
usleep (3) is used for microsecond resolution delay times.

       --si   Use power of 1000 not 1024.
Use a power of 1000 instead of 1024.

       -t, --total
Shows a row showing the total of the columns.

       --help Print help.
Print help.

       -V, --version
Display version information.

FILES
       /proc/meminfo
              memory information

SEE ALSO
       ps(1), slabtop(1), top(1), vmstat(8).

AUTHORS
       Written by Brian Edmonds.

REPORTING BUGS
       Please send bug reports to ⟨[email protected]⟩



procps-ng                          July 2014                           FREE(1)

that's all

Recommended Posts

Check the memory status of the server with the Linux free command
Check the operating status of the server with the Linux top command
Check the HTTP status code response with the curl command (#Linux #Shell)
Check server I / O device usage with the Linux iostat command
Check the memory protection of linux kerne with the code for ARM
See here for the amount of free memory of the free command
How to monitor the execution status of sqlldr with the pv command
Check the existence of the file with python
Status check command used (sometimes) on linux
Linux server command
Linux (command memory)
Calculate the memory sharing rate of Linux processes
Adjust file permissions with the Linux command chmod
[2020July] Check the UDID of the iPad on Linux
Check the date of the flag duty with Python
Compress with zip command of java side linux
Check the status of your data using pandas_profiling
The story of stopping the production service with the hostname command
The story of replacing Nvidia GTX 1650 with Linux Mint 20.1.
[Linux] Execute git pull regularly with the crontab command
Comparison of Windows Server and Free Linux to Commercial Linux
Get the operation status of JR West with Python
Visualize the appreciation status of art works with OpenCV
Check the type and version of your Linux distribution
Understand the attributes of Linux files (ls -l command)
Command to check the total number of CPU physical cores / logical cores / physical memory on Mac
I tried to rewrite the WEB server of the normal Linux programming 1st edition with C ++ 14
Get the id of a GPU with low memory usage
Get UNIXTIME at the beginning of today with a command
Check the scope of local variables with the Python locals function.
Check the code with flake8
[Tips] Persistence of Kali Linux Live Image with USB memory
A Python script that allows you to check the status of the server from your browser
Install the latest version of Git on your Linux server
Linux PC spec check command
Commands and files to check the version of CentOS Linux
Get the host name of the host PC with Docker on Linux
[Linux] I tried to summarize the command of resource confirmation system
[Machine learning] Check the performance of the classifier with handwritten character data
How to check the memory size of a variable in Python
How to check the memory size of a dictionary in Python
How to output the output result of the Linux man command to a file
A command to easily check the speed of the network on the console
I want to check the position of my face with OpenCV!
I used the worldcup command to check the outcome of the World Cup.
[Linux] OS recovery with restore command
Completion of docker command on Linux
[linux] kill command to kill the process
Using cgo with the go command
Hit the top command with htop
The story of remounting the application server
Visualize the response status of the census 2020
Get the width of the div on the server side with Selenium + PhantomJS + Python
Replace the directory name and the file name in the directory together with a Linux command.
[Ota Ward] Check the status of application processing for special flat-rate benefits
[Linux] Command to get a list of commands executed in the past
Edit the file of the SSH connection destination server on the server with VS Code
The --security option cannot be used with the dnf command on CentOS Linux
Display the status of COVID 19 infection in Japan with Splunk (GitHub version)
With the advent of systemd-homed in 2020, Linux user management will change dramatically.
[linux test command] Check the existence of the directory. Used to see if there are too many directories to specify