Linux free command usage and Analysis

Source: Internet
Author: User

Linux free command usage and Analysis
1. Command Format

Free [parameter]
2. command functions

The free command displays system usage and idle memory, including physical memory, interactive zone memory (swap), and kernel buffer memory. The shared memory is ignored.

3. Command Parameters
-B displays memory usage in bytes. -K displays memory usage in KB. -MB: memory usage is displayed in MB. -G displays memory usage in GB. -H automatic conversion unit (most commonly used)-o does not display the buffer adjustment column. -S <interval seconds> continuous observation of memory usage. -T: displays the total memory column. -V displays the version information.
4. Output Parsing
[zhangchengfei@Master:~]$free             total       used       free     shared    buffers     cachedMem:      16079364   14901460    1177904    5278136      65408    5921568-/+ buffers/cache:    8914484    7164880Swap:     12223484    1388724   10834760

freeAll output values of the command are from/proc/meminfo. HerefreeThere are four rows of output, which are explained in sequence below:

4.1 MemLine Parsing

This line of output is from the operating system (OS), that is, from the OS perspective, there are a total of computers:
16079364KB(Default unit: KB) physical memory.14901460KBUsed; also used1177904KB is available;

Here is an equation:

Mem.total = Mem.used + Mem.free

sharedMemory shared by several processes, usedIPC, Now deprecated, but it is displayed on my machine, mainly depends onfreeHow is the command implemented.

bufferMemory of the System buffer, used to store data to be output to disk (Block device.
cachedMemory cached by the system, used to store data read from disk.

The original English version is explained below, both of which are intended to improve IO performance.

A buffer is something that has yet to be “written” to disk.
A cache is something that has been “read” from the disk and stored for later use.

Release Data occupied by system cache;

echo 3>/proc/sys/vm/drop_caches
4.2 -/+ buffers/cacheLine Parsing

This row is used to view the system memory usage from the application perspective.

usedIndicates how much memory the application considers the system to have used;
freeIndicates how much memory the application considers the system to have;

Because the systemcacheAndbufferThe occupied memory can be quickly recycled.free.

There are two equations:

(-/+buffer/cache).used = Mem.used - Mem.buffers - Mem.cached(-/+buffer/cache).free = Mem.free + Mem.buffers + Mem.cached
4.3 SwapLine Parsing

This behavior exchanges partition information, namely, the total amount of swap, the amount of used, and the number of idle swap areas ).

[End]

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.