┌──[root@liruilongs.github.io]-[~] └─$ vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 3 0 0 27270048 3104 984432 0 0 38 23 315 294 4 2 94 0 0
┌──[root@liruilongs.github.io]-[~] └─$ vmstat -a procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free inact active si so bi bo in cs us sy id wa st 0 0 0 23225336 1987728 6884184 0 0 31 145 267 282 1 1 98 0 0
┌──[root@liruilongs.github.io]-[~] └─$ vmstat -s 32931532 K total memory 8498760 K used memory 8329368 K active memory 497280 K inactive memory 23470020 K free memory 3104 K buffer memory 959648 K swap cache 10485756 K total swap 0 K used swap 10485756 K free swap 8162 non-nice user cpu ticks 0 nice user cpu ticks 10277 system cpu ticks 220249 idle cpu ticks 653 IO-wait cpu ticks 0 IRQ cpu ticks 435 softirq cpu ticks 0 stolen cpu ticks 682275 pages paged in 83668 pages paged out 0 pages swapped in 0 pages swapped out 907353 interrupts 828939 CPU context switches 1658547198 boot time 9260 forks
Options: -b, --bytes show output in bytes -k, --kilo show output in kilobytes -m, --mega show output in megabytes -g, --giga show output in gigabytes --tera show output in terabytes --peta show output in petabytes -h, --human show human-readable output --si use powers of 1000 not 1024 -l, --lohi show detailed low and high memory statistics -t, --total show total for RAM + swap -s N, --seconds N repeat printing every N seconds -c N, --count N repeat printing N times, thenexit -w, --wide wide output
--help display this help and exit -V, --version output version information and exit
For more details see free(1).
常用命令
1 2 3 4 5 6 7 8 9 10
┌──[root@liruilongs.github.io]-[~] └─$ free total used free shared buff/cache available Mem: 32931532 8820980 22388436 27388 1722116 23579356 Swap: 10485756 0 10485756 ┌──[root@liruilongs.github.io]-[~] └─$ free -h total used free shared buff/cache available Mem: 31G 8.4G 21G 26M 1.6G 22G Swap: 9G 0B 9G
统计信息
说明
Total
物理内存与交换空间的总量
Used
使用的物理内存和交换分区的容量
Free
未使用的物理内存和交换分区的容量
shared
进程共享内存使用量,该项已过时,应忽略
Buffers
用作硬盘写缓冲区的物理内存的容量
Cached
用作硬盘读缓存的物理内存的容量
High
高端内存或不能被内核直接访问的内存总量
Low
低端内存或能被内核直接访问的内存总量
Totals
对Total、Used和Free列,该项显示的是该列中物理内存和交换分区的总和
-l 向你展示使用了多少高端内存和多少低端内存
1 2 3 4 5 6 7
┌──[root@liruilongs.github.io]-[~] └─$ free -l total used free shared buff/cache available Mem: 32931532 4835004 24441680 35596 3654848 27657976 Low: 32931532 8489852 24441680 High: 0 0 0 Swap: 10485756 0 10485756
-t 命令可以查看内存的统计信息
1 2 3 4 5 6
┌──[root@liruilongs.github.io]-[~] └─$ free -t total used free shared buff/cache available Mem: 32931532 5005552 24808440 35588 3117540 27487560 Swap: 10485756 0 10485756 Total: 43417288 5005552 35294196
选项说明
-s delay :使free按每delay秒的间隔输出新的内存统计数据
-c count :使free 输出count次新的统计数据
1 2 3 4 5 6 7 8 9 10 11
┌──[root@liruilongs.github.io]-[~] └─$ free -s 2 -c 2 total used free shared buff/cache available Mem: 32931532 5405500 24408372 35588 3117660 27087612 Swap: 10485756 0 10485756
total used free shared buff/cache available Mem: 32931532 5405460 24408388 35588 3117684 27087652 Swap: 10485756 0 10485756 ┌──[root@liruilongs.github.io]-[~] └─$
Options: -d, --delay <secs> delay updates -o, --once only display once, thenexit -s, --sort <char> specify sort criteria by character (see below)
-h, --help display this help and exit -V, --version output version information and exit
The following are valid sort criteria: a: sort by number of active objects b: sort by objects per slab c: sort by cache size l: sort by number of slabs v: sort by number of active slabs n: sort by name o: sort by number of objects (the default) p: sort by pages per slab s: sort by object size u: sort by cache utilization
For more details see slabtop(1).
1 2 3 4 5 6 7 8 9 10
Active / Total Objects (% used) : 2172003 / 2195023 (99.0%) Active / Total Slabs (% used) : 49649 / 49649 (100.0%) Active / Total Caches (% used) : 69 / 95 (72.6%) Active / Total Size (% used) : 466189.06K / 477588.18K (97.6%) Minimum / Average / Maximum Object : 0.01K / 0.22K / 8.00K