1. Concept
Used to display the memory status. The free command will display the memory usage, including physical memory, virtual swap file memory, shared memory segments, and buffers used by the system core.
2. Grammar
free [Parameter] [-s <time>]
Parameter description: -bkmotV
-b Displays the memory usage in Byte.
-k Displays the memory usage in KB.
-m Displays the memory usage in MB.
-h Displays the memory usage in appropriate units, up to three digits, and automatically calculates the corresponding unit value. The units are:
B = bytes
K = kilos
M = megas
G = gigas
T = teras
-o Do not display the buffer adjustment column.
-t shows the total memory column.
-V Display version information.
-s <time> The time refers to the number of seconds between intervals, and continuously observe the memory usage.
Usage: command + parameter (one or more parameters), defined according to your own needs.
Three, example
1. Display memory usage information: free
Output parameter description:
The Mem line (the second line) is the memory usage.
The Swap line (third line) is the usage of swap space.
The total column shows the total available physical memory and swap space of the system.
The used column shows the physical memory and swap space that has been used.
The free column shows how much physical memory and swap space are available.
The shared column shows the size of the physical memory being shared.
The buff/cache column shows the size of physical memory used by buffer and cache.
The available column shows the amount of physical memory that can also be used by the application.
2. Display memory usage information in the form of a sum: free -t
3. Periodically query memory usage information, execute the command every 10s: free -s 10
Common command combinations: free or free -h
Learning source:
https://www.runoob.com/linux/linux-comm-free.html
https://www.cnblogs.com/ultranms/p/9254160.html