su-kaiyao translated

This commit is contained in:
su-kaiyao 2014-12-10 20:50:34 +08:00
parent 0c763de017
commit e2dd61786b
2 changed files with 147 additions and 131 deletions

View File

@ -1,131 +0,0 @@
[su-kaiyao]translating
10 free Commands to Check Memory Usage in Linux
================================================================================
**Linux** is one of the most popular open source operating system and comes with huge set of commands. The most important and single way of determining the total available space of the **physical memory** and **swap memory** is by using “**free**” command.
The Linux “**free**” command gives information about total used and available space of **physical memory** and **swap memory** with **buffers** used by kernel in **Linux/Unix** like operating systems.
![10 Linux Free Command Examples](http://www.tecmint.com/wp-content/uploads/2012/09/Linux-Free-commands.png)
This article provides some useful examples of “**free**” commands with options, that might be useful for you to better utilize memory that you have.
### 1. Display System Memory ###
Free command used to check the used and available space of **physical memory** and **swap memory** in **KB**. See the command in action below.
# 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 ###
Free command with option **-b**, display the size of 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 Kilo Bytes ###
Free command with option **-k**, display the size of memory in (KB) **Kilobytes**.
# 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 see the size of the memory in **(MB) Megabytes** use option as **-m**.
# 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 ###
Using **-g** option with free command, would display the size of the memory in **GB(Gigabytes)**.
# free -g
total used free shared buffers cached
Mem: 0 0 0 0 0 0
-/+ buffers/cache: 0 0
Swap: 3 0 3
### 6. Display Total Line ###
Free command with -t option, will list the total line at the end.
# 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. Disable Display of Buffer Adjusted Line ###
By default the free command display “**buffer adjusted**” line, to disable this line use option as -o.
# free -o
total used free shared buffers cached
Mem: 1021628 912520 109108 0 120368 655548
Swap: 4194296 0 4194296
### 8. Dispaly Memory Status for Regular Intervals ###
The -s option with number, used to update free command at regular intervals. For example, the below command will update 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 Low and High Memory Statistics ###
The -l switch displays detailed high and low memory size statistics.
# 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 Free Version ###
The -V option, display free command version information.
# free -V
procps version 3.2.8
--------------------------------------------------------------------------------
via: http://www.tecmint.com/check-memory-usage-in-linux/
作者:[Ravi Saive][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/admin/

View File

@ -0,0 +1,147 @@
10个检测Linux内存使用情况的free命令
===
**Linux**是最有名的开源操作系统之一,它拥有着极其巨大的指令集。确定**物理内存**和**交换内存**所有可用空间的最重要,也是唯一的方法是使用“**free**”命令。
Linux “**free**”命令通过给出**Linux/Unix**操作系统中内核已使用的**buffers**情况,来提供**物理内存**和**交换内存**的总使用量和可用量。
![10 Linux Free Command Examples](http://www.tecmint.com/wp-content/uploads/2012/09/Linux-Free-commands.png)
这篇文章提供一些带有参数选项的“**free**”命令,这些命令对于你更好地利用你的内存会有帮助。
### 1. 显示你的系统内存 ###
free命令用于检测**物理内存**和**交换内存**已使用量和可用量(单位为**KB**)。下面演示命令的使用情况。
# free
total used free shared buffers cach
ed
Mem: 1021628 912548 109080 0 120368 6555
48
-/+ buffers/cache: 136632 884996
Swap: 4194296 0 4194296
### 2. 以字节为单位显示内存 ###
加上**-b**参数的free命令以**字节**为单位显示内存的大小。
# free -b
total used free shared buffers cach
ed
Mem: 1046147072 934420480 111726592 0 123256832 6712811
52
-/+ buffers/cache: 139882496 906264576
Swap: 4294959104 0 4294959104
### 3. 以千字节为单位显示内存 ###
加上**-k**参数的free命令以(KB)**千字节**为单位显示内存大小。
# free -k
total used free shared buffers cach
ed
Mem: 1021628 912520 109108 0 120368 655548
-/+ buffers/cache: 136604 885024
Swap: 4194296 0 4194296
### 4. 以兆字节为单位显示内存 ###
想以**(兆字节)**显示内存大小,使用**-m**参数。
# free -m
total used free shared buffers cach
ed
Mem: 997 891 106 0 117 6
40
-/+ buffers/cache: 133 864
Swap: 4095 0 4095
### 5. 以千兆字节为单位显示内存 ###
使用**-g**为参数,将会以**GB(千兆字节)**为单位显示内存大小。
# free -g
total used free shared buffers cached
Mem: 0 0 0 0 0
0
-/+ buffers/cache: 0 0
Swap: 3 0 3
### 6. 显示总计行 ###
加上-t选项将会在屏幕最后列出总计一行。
# free -t
total used free shared buffers cache
d
Mem: 1021628 912520 109108 0 120368 6555
48
-/+ buffers/cache: 136604 885024
Swap: 4194296 0 4194296
Total: 5215924 912520 4303404
### 7. 关闭显示缓冲区调整一行 ###
默认情况下free命令是显示“**缓冲区调整**”一行的,为了关闭显示,可以加上-o参数。
# free -o
total used free shared buffers cache
d
Mem: 1021628 912520 109108 0 120368 6555
48
Swap: 4194296 0 4194296
### 8. 定期时间间隔更新内存状态 ###
-s选项加上一个整数用来在定期时间间隔内更新free命令。举个例子下面的命令将会在每5秒更新一个free命令。
# free -s 5
total used free shared buffers cach
ed
Mem: 1021628 912368 109260 0 120368 6555
48
-/+ buffers/cache: 136452 885176
Swap: 4194296 0 4194296
### 9. 显示底和高内存统计信息 ###
-l选项显示了具体的高和低内存的使用统计情况。
# free -l
total used free shared buffers cach
ed
Mem: 1021628 912368 109260 0 120368 6555
48
Low: 890036 789064 100972
High: 131592 123304 8288
-/+ buffers/cache: 136452 885176
Swap: 4194296 0 4194296
### 10. 检查free命令版本 ###
-V选项显示free命令版本信息。
# free -V
procps version 3.2.8
---
via: http://www.tecmint.com/check-memory-usage-in-linux/
作者:[Ravi Saive][a]
译者:[su-kaiyao](https://github.com/su-kaiyao)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中>
国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/admin/