N天学习一个Linux命令之free

Posted huan & ping

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了N天学习一个Linux命令之free相关的知识,希望对你有一定的参考价值。

用途

查看系统内存(物理/虚拟/缓存/共享)使用情况

用法

free [-b | -k | -m | -g | -h] [-o] [-s delay ] [-c count ] [-a] [-t] [-l] [-V]

常用选项

选项 含义 说明
-b 单位byte switch displays the amount of memory in bytes;
-k 单位k switch (set by default) displays it in kilobytes;
-m 单位m switch displays it in megabytes;
-g 单位g switch displays it in gigabytes;
-h 人类可读方式 switch displays all output fields automatically scaled to the shortest (three digit) representation including the unit. That makes the values human readable.
-t 显示汇总行 switch displays a line containing the totals.
-o disables the display of a "buffer adjusted" line switch disables the display of a "buffer adjusted" line. If the -o option is not specified, free subtracts buffer memory from the used memory and adds it to the free memory reported.
-s 间隔秒数 间隔几秒重复刷新显示 switch activates continuous polling delay seconds apart. You may actually specify any floating point number for delay, usleep(3) is used for microsecond resolution delay times.
-c 次数 重复刷新显示总次数 switch used together with the -s switch interrupts the polling after count repetitions.
-l 显示low行 switch shows detailed low and high memory statistics.
-a 显示可用内存 switch shows the available memory (if supported by the running kernel and enabled with sysctl -w vm.mem-info_legacy_layout=0 ; shows zero when unsupported or disabled). The produced output is wider than 80 characters.
-V 显示程序版本信息 switch displays version information.

实践

1 显示内存使用情况

[root@vm ~]# free -h
             total       used       free     shared    buffers     cached
Mem:          2.9G       2.7G       209M        37M        11M       185M
-/+ buffers/cache:       2.5G       405M
Swap:         1.6G       1.2G       415M

参考资料

【1】man free
【2】每天一个linux命令(45):free 命令
http://www.cnblogs.com/peida/archive/2012/12/25/2831814.html
【3】Linux上的free命令详解
http://www.cnblogs.com/coldplayerest/archive/2010/02/20/1669949.html

以上是关于N天学习一个Linux命令之free的主要内容,如果未能解决你的问题,请参考以下文章

N天学习一个linux命令之ip

N天学习一个Linux命令之top

N天学习一个linux命令之ss

N天学习一个Linux命令之帮助命令:grep

N天学习一个Linux命令之帮助命令:grep

N天学习一个Linux命令之ln