Reprint: http://linux.cn/article-4755-1.html
Linux is one of the most famous open-source operating systems, and it has an extremely large set of commands. The most important and unique way to determine all available space for physical memory and swap memory is to usethe "free" command.
The Linux"free" command gives the total amount of physical memory and swap memory used in the class Linux/unix operating system, the amount of usable, and the buffer used by the kernel.
This article provides some "free" commands for avariety of parameter options that are useful for you to better utilize your memory.
1. Display your system memory
The free command detects the amount of physical memory and swap memory used and available (the default is kilobytes). The following shows the usage of the command.
- # free
- Total used free shared buffers Cached
- Mem: 1021628 912548 109080 0 120368 655548
- -/+ buffers/cache: 136632 884996
- Swap: 4194296 0 4194296
2. Display memory in bytes
The free command with the- b parameter displays the size of the memory in bytes .
- # Free-b
- Total used free shared buffers Cached
- Mem: 1046147072 934420480 111726592 0 123256832 671281152
- -/+ buffers/cache: 139882496 906264576
- Swap: 4294959104 0 4294959104
3. Display memory in kilobytes
Add the- k parameter to the free command (the default unit, so you can use it without it ), to display the memory size in kilobytes (KB).
- # free-k
- Total used free shared buffers Cached
- Mem: 1021628 912520 109108 0 120368 655548
- -/+ buffers/cache: 136604 885024
- Swap: 4194296 0 4194296
4. Display memory in megabytes
To display memory size in (megabytes) , use the- m parameter.
- # free-m
- Total used free shared buffers Cached
- Mem: 997 891 106 0 117 640
- -/+ buffers/cache: 133 864
- Swap: 4095 0 4095
5. Display memory in gigabytes
With the- G parameter, the memory size will be displayed in gigabytes (gigabyte) .
- # free-g
- Total used free shared buffers Cached
- Mem: 0 0 0 0 0 0
- -/+ buffers/cache: 0 0
- Swap: 3 0 3
6. Show Total rows
With the-t option, the total line will be listed at the end of the screen.
- # free-t
- Total used free shared buffers Cached
- Mem: 1021628 912520 109108 0 120368 655548
- -/+ buffers/cache: 136604 885024
- Swap: 4194296 0 4194296
- total: 5215924 912520 4303404
7. Turn off the display buffer adjustment line
By default, the free command displays a row of buffer adjustments and, in order to turn off the display, you can add the-o parameter.
- # Free-o
- Total used free shared buffers Cached
- Mem: 1021628 912520 109108 0 120368 655548
- Swap: 4194296 0 4194296
8. Update memory status at regular intervals
The-s option, plus an integer, is used to update the free command within a regular interval. For example, the following command will update a free command every 5 seconds.
- # free-s 5
- Total used free shared buffers Cached
- Mem: 1021628 912368 109260 0 120368 655548
- -/+ buffers/cache: 136452 885176
- Swap: 4194296 0 4194296
9. Show bottom and high memory statistics
The-l option shows specific usage statistics for high and low memory.
- # free-l
- Total used free shared buffers Cached
- Mem: 1021628 912368 109260 0 120368 655548
- Low: 890036 789064 100972
- High: 131592 123304 8288
- -/+ buffers/cache: 136452 885176
- Swap: 4194296 0 4194296
10. Check the free command version
-V option to display the free command version information.
- # free-v
- Procps version 3.2. 8
via:http://www.tecmint.com/check-memory-usage-in-linux/
Ravi saive Translator: Su-kaiyao proofreading: Wxy
10 Examples of FREE commands to detect Linux memory usage