10 Examples of FREE commands to detect Linux memory usage

Source: Internet
Author: User

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.

  1. # free
  2. Total used free shared buffers Cached
  3. Mem: 1021628 912548 109080 0 120368 655548
  4. -/+ buffers/cache: 136632 884996
  5. Swap: 4194296 0 4194296
2. Display memory in bytes

The free command with the- b parameter displays the size of the memory in bytes .

  1. # Free-b
  2. Total used free shared buffers Cached
  3. Mem: 1046147072 934420480 111726592 0 123256832 671281152
  4. -/+ buffers/cache: 139882496 906264576
  5. 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).

  1. # free-k
  2. Total used free shared buffers Cached
  3. Mem: 1021628 912520 109108 0 120368 655548
  4. -/+ buffers/cache: 136604 885024
  5. Swap: 4194296 0 4194296
4. Display memory in megabytes

To display memory size in (megabytes) , use the- m parameter.

  1. # free-m
  2. Total used free shared buffers Cached
  3. Mem: 997 891 106 0 117 640
  4. -/+ buffers/cache: 133 864
  5. Swap: 4095 0 4095
5. Display memory in gigabytes

With the- G parameter, the memory size will be displayed in gigabytes (gigabyte) .

  1. # free-g
  2. Total used free shared buffers Cached
  3. Mem: 0 0 0 0 0 0
  4. -/+ buffers/cache: 0 0
  5. Swap: 3 0 3
6. Show Total rows

With the-t option, the total line will be listed at the end of the screen.

  1. # free-t
  2. Total used free shared buffers Cached
  3. Mem: 1021628 912520 109108 0 120368 655548
  4. -/+ buffers/cache: 136604 885024
  5. Swap: 4194296 0 4194296
  6. 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.

    1. # Free-o
    2. Total used free shared buffers Cached
    3. Mem: 1021628 912520 109108 0 120368 655548
    4. 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.

  1. # free-s 5
  2. Total used free shared buffers Cached
  3. Mem: 1021628 912368 109260 0 120368 655548
  4. -/+ buffers/cache: 136452 885176
  5. Swap: 4194296 0 4194296
9. Show bottom and high memory statistics

The-l option shows specific usage statistics for high and low memory.

  1. # free-l
  2. Total used free shared buffers Cached
  3. Mem: 1021628 912368 109260 0 120368 655548
  4. Low: 890036 789064 100972
  5. High: 131592 123304 8288
  6. -/+ buffers/cache: 136452 885176
  7. Swap: 4194296 0 4194296
10. Check the free command version

-V option to display the free command version information.

    1. # free-v
    2. 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

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.