Bash 在shell中查询内存详细信息
是否有一个shell命令来了解在特定时刻使用了多少内存,以及每个进程使用了多少内存,剩下多少虚拟内存等详细信息?取决于您的操作系统。在Linux中,Bash 在shell中查询内存详细信息,bash,memory,shell,memory-management,Bash,Memory,Shell,Memory Management,是否有一个shell命令来了解在特定时刻使用了多少内存,以及每个进程使用了多少内存,剩下多少虚拟内存等详细信息?取决于您的操作系统。在Linux中,free回答了三个问题中的两个 ~> free total used free shared buffers cached Mem: 904580 895128 9452 0 63700 777728 -
free
回答了三个问题中的两个
~> free
total used free shared buffers cached
Mem: 904580 895128 9452 0 63700 777728
-/+ buffers/cache: 53700 850880
Swap: 506036 0 506036
“交换”指的是虚拟内存。对于“每个进程”,如何处理top
:
PhysMem: 238M wired, 865M active, 549M inactive, 1652M used, 395M free.
VM: 162G vsize, 1039M framework vsize, 124775(0) pageins, 9149(0) pageouts.
PID COMMAND %CPU TIME #TH #WQ #POR #MREG RPRVT RSHRD RSIZE VPRVT VSIZE PGRP PPID STATE UID
7233 top 5.7 00:00.53 1/1 0 24 33 1328K 264K 1904K 17M 2378M 7233 3766 running 0
e、 g:
我们也来听听这首古老的经典之作,
vmstat
$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 30160 15884 418680 281936 0 0 406 22 6 3 1 1 93 5
如果您使用的是最新的Linux,
cat/proc/$pid/smaps
如果您使用的是OSX,请检查。如果您使用的是Linux,请尝试。bash在任何地方都不起作用:不同的操作系统需要不同的命令。
$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 30160 15884 418680 281936 0 0 406 22 6 3 1 1 93 5