1. Command introduction
When our online maintenance server is running normally, a very important indicator is about the memory utilization rate. When the memory utilization rate of our server is too high, it is bound to reduce the operation performance of the server. In this regard, we will build some real-time monitoring platforms to facilitate visual management. Such as pagoda panel. In addition, we will use some Linux commands for verification and analysis, such as top, free and other commands. We will master common Linux commands in 21 days. Challenge: day 3: free usage of common Linux commands. Introduce the usage of top. Interested friends can learn about it.
Today, we mainly introduce the usage of the free command, which can quickly clarify the system memory usage and monitor the memory usage of the server.
2. English meaning
free Free, release
3. Syntax format
free [option]
4. Description of options
Instruction description
- -h displays memory usage in appropriate units
- -m displays memory information in MB
- -k displays memory information in kilobytes
- -S < interval seconds > continuously observe the memory usage
- -Tdisplays the total memory information for each column
- -V display version information
Display description
option | explain |
---|---|
total | Total physical memory available to the system |
used | The amount of physical memory that has been used |
free | Free available physical memory size |
shared | The amount of physical memory used by the share |
buff/cache | Memory size of disk cache |
available | The amount of memory that the application considers available |
5. Example description
Display memory usage information (default unit: KB)
[root@iZ ~]# free total used free shared buff/cache available Mem: 3825736 785500 730740 35768 2309496 2732764 Swap: 1049596 0 1049596 #### Displays memory usage information in MB [root@iZ ~]# free -m total used free shared buff/cache available Mem: 3736 767 713 34 2255 2668 Swap: 1024 0 1024 #### Displays memory usage information in GB [root@iZ ~]# free -g total used free shared buff/cache available Mem: 3 0 0 0 2 2 Swap: 1 0 1
Easy to read display memory information in unit mode
[root@iZ ~]# free -h total used free shared buff/cache available Mem: 3.6Gi 766Mi 713Mi 34Mi 2.2Gi 2.6Gi Swap: 1.0Gi 0B 1.0Gi #### Displays the utilization of high and low memory [root@iZ ~]# free -l total used free shared buff/cache available Mem: 3825736 785152 730944 35768 2309640 2733068 Low: 3825736 3094792 730944 High: 0 0 0 Swap: 1049596 0 1049596
Display all memory (count the total information of each column)
[root@iZ ~]# free -t total used free shared buff/cache available Mem: 3825736 785232 730856 35768 2309648 2732988 Swap: 1049596 0 1049596 Total: 4875332 785232 1780452
Execute memory information every N seconds (temporary, non permanent)
[root@iZ ~]# free -s 3 total used free shared buff/cache available Mem: 3825736 784932 731128 35768 2309676 2733288 Swap: 1049596 0 1049596 total used free shared buff/cache available Mem: 3825736 785304 730756 35768 2309676 2732916 Swap: 1049596 0 1049596 total used free shared buff/cache available Mem: 3825736 785428 730632 35768 2309676 2732792 Swap: 1049596 0 1049596
The memory information is executed every N seconds, and the execution specification is executed only n times
free -s 3 -c 5
Well, that's all for today's study! Welcome to the message area to participate in communication and discussion. Originality is not easy. Welcome to collect and forward support!