free command

Linux uses it‘s memory in a very efficient way . Here I am not going to write on memory management in Linux , but would try to understand how to view the memory usage in a Linux box. Linux will always try to use free RAM for caching stuff, so "free" will report almost always very low free memory . We have the free command as a reporting tool for memory usage . Let us now look at the output of free command .

-bash-3.00$ free -m
                     total        used        free     shared     buffers     cached
Mem:           2007       1902        105          0          150           761
-/+ buffers/cache:        990       1016
Swap:         1963          0       1963

Initially was having the understanding that the free column in the above output gives me the free memory in my box and my box is really low in memory. But this is not exactly the case. We will see how .

Interpreting output of free Command:

Let‘s now understand the headers from the output of the above command.

Total: The total amount of RAM on the system minus the amount has been used in loading the kernel. 
Used: The amount of memory used by applications in the system . This does not mean that all these
           memory are used by the current running applications in the system but this also includes
           memory reserved for caching and buffering purpose.
Free : The amount of free memory in the system .
Shared : This is the  shared memory . An indication of how much memory is common to more than
              one process. 
Buffers: This entry indicates how much of the memory in use is currently being used for disk
              buffering. File system metadata and other block reads are cached in the buffer cache. 
Cached: This entry indicates how much of the memory in use is currently being used for caching
              purpose. Applications which are not running but was running few minutes back is cached in
              memory with the idea that it will make the application running faster when it runs again. This
              memory can be reclaimed .
-/+ buffers/cache: This shows the cached data and buffers for IO.  The free section actually gives us
                             how much memory is available for use on the system. Caches will be freed
                             automatically if memory gets scarce, so they do not really matter.

Now let us see how we can calculate these values provided by the free command for the above output .

Buffers + Cache  =  150 + 761 =  911

Used - Buffers - Cache = 1902 - 911 = 991 

The lower value gives us the actual amount of memory used by the applications . This value is equal to the first row in the second column.  Rest of the used memory will be released by the OS if memory becomes scarce.

Buffers + Cache + free =  911 + 105 = 1016 

The above value is the actual amount of memory that can be allocated to the  applications by the OS depending on usage. This value is equal to the free column in the second row . We should began to worry when this value is low. The OS will start paging after that and hence system performance will be impacted because disk is many times slow than memory.

时间: 2024-11-25 10:31:05

free command的相关文章

MISP版本嵌入式QT编译时出现mips-linux-gcc command not found

configure的时候都没什么问题我的configure是:./configure -prefix /opt/qt-jz -xplatform qws/linux-mips-g++ -embedded mips  configure顺利的过了,但是当make的时候,出现了mips-linux-gcc :Commond not fount! 我装的是mipsl-linux-gcc ,而且已经交叉编译过了个hello world了.. make时出现的错误是:make[1]: Entering d

quagga源码分析--通用库command

quagga是一个完整又成熟的系统,作为一个路由器软件,自然要提供人机接口. quagga提供snmp管理接口,而且,自然就会有对应的命令行管理格式,当然一般路由软件不会提供界面形式的,也许有webui,然而quagga并没有. 我们要看的就是这个命令行处理的代码 command. 接触过类似命令行的朋友肯定有一点点好奇吧,那么数量庞大的命令和参数输入,还可以提供提示和自动补齐,这肯定不是一件很简单的事情. 下面是一个配置示例: 1 ! 2 interface bge0 3 ip ospf au

加载语音license command

FUYI#copytftp flash0: Addressor name of remote host []? 1.1.1.1 Sourcefilename []? FGL162212WS_201606290212473480.lic Destinationfilename [FGL162212WS_201606290212473480.lic]? Accessingtftp://1.1.1.1/FGL162212WS_201606290212473480.lic... LoadingFGL16

Linux bash: scp: command not found的问题记录

1,scp报错 [[email protected] soft]# scpjdk-7u55-linux-x64.tar.gz 192.168.121.246:/soft/ [email protected]'s password: bash: scp: command not found lost connection [[email protected] soft]# 2,调试-v [[email protected] soft]# scp -vjdk-7u55-linux-x64.tar.g

mv command:unable to remove target: Is a director

mv command:unable to remove target: Is a director This is somewhat simple as long as we understand the concept. mv or move does not actually move the file/folder to another location within the same device, it merely replaces the pointer in the first

CentOS 中无法使用make,make install 命令 make: command not

CentOS 中无法使用make,make install 命令 make: command not found 1.安装make yum -y install gcc automake autoconf libtool make 2.安装gcc yum install gcc gcc-c++

Understanding the Top command on Linux

Article by AlexioBash published on his website about ArchLinux in italian. Know what is happening in "real time" on your systems is in my opinion the basis to use and optimize your OS. On ArchLinux or better on GNU/Linux in general thetopcommand

bash:yum:command not found 解决办法

最近在学rhel7,不知道怎么回事,今天突然yum不能用了, 提示: bash:yum:command not found 在度娘搜了半天,真不好说啥了. 自己研究了半天 步骤如下 第一步: http://mirrors.163.com/centos/7/os/x86_64/Packages/ 到上面这个网站去下载如下RPM包 python-iniparse-0.4-9.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-

解决 linux -bash: telnet: command not found

输入命令telnet提示  linux -bash: telnet: command not found 解决方法: yum list telnet*   查看telnet相关的安装包 yum install telnet-server 安装telnet服务 yum install telnet.* 安装telnet客户端 然后运行telnet正常了

mysql SELECT command denied to user 'root'@'localhost' for table 'XXX' 报错1142

还是数据库权限的问题,不知道为啥赋给了所有权限后还是有各种权限问题,看来有空得整理一下mysql所有相关权限的问题了... 下面才是解决这个select权限的方法: mysql SELECT command denied to user 'root'@'localhost' for table 'XXX' 报错1142