`

正确理解 output of linux command free

 
阅读更多

linux command free is used to show the RAM usage of the system. Below is an example output of the command: 

 

$ free -m

                     total       used       free     shared    buffers     cached

Mem:          2000       1921         78          0          6         34

-/+ buffers/cache:       1881        119

Swap:            0          0          0

 

The "-m" switch outputs in megabyte. So the system:

 

  1. has total RAM of 2G.
  2. Used 1921M, but in this Used Mem, it includes 6M as buffers and 34M for cached data.
  3. Absolutely free (not used by anything) memory is 78M.
  4. If necessary, the system can use the buffered and cached memory for other processes. Therefore, the actual used memory is "used" - "buffers" - "cached", ie. 1921 - 6 - 34 = 1881M. This is lised on the 2nd line of the output:          "-/+ buffers/cache  1881  119".
  5. Note the "-/+ buffers/cache  1881  119" has a "-/+" at the beginning. I think "-" means what we talked about in point 4. While "+" means that the actual free memory is "free" + "buffers" + "cached" = 78 + 6 + 34 (roughly 119M). Since the system can use that 119M for other processes (at most 119M can be allocated as free memory).
分享到:
评论

相关推荐

    Linux Shell Scripting Essentials 无水印pdf 0分

    Redirect input, output, and errors of a command or script execution to other streams Debug code with different shell debugging techniques to make your scripts bug-free Manage processes, along with the...

    Pro.Bash.Programming.Scripting.the.GNULinux.Shell.2nd.Edition

    Beginning Linux and Unix system administrators who want to be in full command of their systems. Table of Contents Chapter One: Hello, World! Your First Shell Program Chapter Two: Input, Output, and ...

    linux 下 operating system chapter2 projet 的代码及编译方法

    linux 下 operating system chapter2 projet 的代码及编译方法(含C语言代码,Makefile, report) In the module entry point, create a linked list containing five struct birthday elements. Traverse the ...

    Pro Bash Programming

    Who this book is for Beginning Linux and Unix system administrators who want to be in full command of their systems. Table of Contents * Hello, World! Your First Shell Program * Input, Output, and ...

    Pro Bash Programming 2015

    Who this book is for Beginning Linux and Unix system administrators who want to be in full command of their systems. Table of Contents * Hello, World! Your First Shell Program * Input, Output, and ...

    sed_awk.chm

    A number of scripts are explained, including one that modifies the output of the ls command. Chapter 8, Conditionals, Loops, and Arrays, describes how to use common programming constructs such as ...

    Midnight Commander Win32 port

    This is version 4 of the Midnight Commander, a free Norton Commander Clone with many useful features. The Midnight Commander comes with mouse support on xterms and optionally on the Linux console. ...

    acpi控制笔记本风扇转速

    Enhanced the implementation of the "serialized mode" of the interpreter (enabled via the AcpiGbl_AllMethodsSerialized flag.) When this mode is specified, instead of creating a serialization semaphore ...

    i-vector的工具箱

    The MCR installer can be obtained free of charge from the web address: http://www.mathworks.com/products/compiler/mcr/ The binaries supplied with this version of the toolkit need version 8.1 (R2013...

    myasm51,小型的51单片机汇编器源码

    -F to fill free bit with 0 or 1, (default 0) -C to turn on/off symbol case sensitive, (default on) -d to turn on/off the parser debug mode, (default off) [root@rh9 examples]# myasm51 dclk7seg2.asm...

    javacv-platform-1.3.3-src

    but to get binaries for only one platform we can set the javacpp.platform system property (via the -D command line option) to something like android-arm, linux-x86_64, macosx-x86_64, windows-x86_64, ...

    DebuggingWithGDB 6.8-2008

    Table of Contents Summary of gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Free Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

    Debugging with GDB --2007年

    Table of Contents Summary of GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Free software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

    .htaccess

    <br>To prevent against this (without creating lots of new 'index' files, you can enter a command into your .htaccess file to stop the directory list from being shown: 为避免这种情况(而不必创建...

    myasm51-51单片机汇编器源码

    -F to fill free bit with 0 or 1, (default 0) -C to turn on/off symbol case sensitive, (default on) -d to turn on/off the parser debug mode, (default off) [root@rh9 examples]# myasm51 dclk7seg2.asm...

    grub4dos-V0.4.6a-2017-02-04更新

    1.(tinybit) Workaround for BIOS of BENQ notebook that only supports 1. 2014-10-15 1.workaround for issue 204(chenall) 2014-10-12 1.skip_to()函数修改,对于引号里面的”\”使用以前的方法处理,保持兼容...

Global site tag (gtag.js) - Google Analytics