Linux下查看某个进程占用的CPU、内存

 

1、用top命令指定固定的PID

top -p 10997
Linux下查看某个进程占用的CPU、内存_第1张图片

 


2、查询指定进程的PID

ps -ef | grep zookeeper


3、使用ps查询指定进程名或者PID的占用情况

ps -aux | grep zookeeper

ps -aux | grep 2181


 

4、查看更详细的内存占比

cat /proc/10997/status

Name:    java
State:    S (sleeping)
Tgid:    10997
Ngid:    0
Pid:    10997
PPid:    1959
TracerPid:    0
Uid:    1000    1000    1000    1000
Gid:    1000    1000    1000    1000
FDSize:    256
Groups:    4 24 27 30 46 113 128 130 132 134 1000 1002 
NStgid:    10997
NSpid:    10997
NSpgid:    10987
NSsid:    10914
VmPeak:    11522940 kB
VmSize:    11522940 kB
VmLck:           0 kB
VmPin:           0 kB
VmHWM:       65176 kB
VmRSS:       65176 kB
VmData:    11462972 kB
VmStk:         140 kB
VmExe:           4 kB
VmLib:       17064 kB
VmPTE:         460 kB
VmPMD:          28 kB
VmSwap:           0 kB
HugetlbPages:           0 kB
Threads:    25
SigQ:    0/128292
SigPnd:    0000000000000000
ShdPnd:    0000000000000000
SigBlk:    0000000000000000
SigIgn:    0000000000000003
SigCgt:    2000000181005ccc
CapInh:    0000000000000000
CapPrm:    0000000000000000
CapEff:    0000000000000000
CapBnd:    0000003fffffffff
CapAmb:    0000000000000000
Seccomp:    0
Cpus_allowed:    ff
Cpus_allowed_list:    0-7
Mems_allowed:    00000000,00000001
Mems_allowed_list:    0
voluntary_ctxt_switches:    86
nonvoluntary_ctxt_switches:    2

VmRSS为内存
 

你可能感兴趣的:(ubuntu,and,linux,linux,运维,服务器)