查看运行的进程,进程id,运行时间,占用内存,线程,结束进程(二)ps/top/cat/ptree等查看线程数
1、使用ps查看:
1)使用top或者已经知道进程名字直接查看ID或者程序名字:
方法1、[test_pkuhpc@login05 2019test]$ ps -eLf | grep ossutil64
方法二、[test_pkuhpc@login05 2019test]$ ps xH 39960
方法三、[test_pkuhpc@login05 2019test]$ ps -m 39960
PID TTY STAT TIME COMMAND
39960 pts/18 - 3:00 ossutil64 cp oss://annoroad-2019-11-16/
- - Sl+ 0:02 -
- - Sl+ 0:14 -
- - Sl+ 0:04 -
- - Sl+ 0:00 -
- - Sl+ 0:00 -
- - Sl+ 0:05 -
- - Sl+ 0:00 -。。。。。
2、使用pstree
[test_pkuhpc@login05 2019test]$ pstree -p 39960
ossutil64(39960)─┬─{ossutil64}(39961)
├─{ossutil64}(39962)
├─{ossutil64}(39963)
├─{ossutil64}(39964)
├─{ossutil64}(39971)
├─{ossutil64}(39981)
├─{ossutil64}(39982)
├─{ossutil64}(39983)
├─{ossutil64}(39984)
├─{ossutil64}(39985)。。。。。
查看所有的进程树
3、使用cat 查看,这个最详细
test_pkuhpc@login05 2019test]$ cat /proc/39960/status
Name:ossutil64
Umask:0002
State:S (sleeping)
Tgid:39960
Ngid:517
Pid:39960
PPid:7299
TracerPid:0
Uid:30519305193051930519
Gid:30523305233052330523
FDSize:256
Groups:30523
VmPeak: 1977228 kB
VmSize: 1922720 kB(内存)
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 10940 kB
VmRSS: 10940 kB
RssAnon: 6892 kB
RssFile: 4048 kB
RssShmem: 0 kB
VmData: 1908456 kB
VmStk: 136 kB
VmExe: 3068 kB
VmLib: 2076 kB
VmPTE: 432 kB
VmSwap: 0 kB
Threads:62(线程数)
SigQ:0/386443
SigPnd:0000000000000000
ShdPnd:0000000000000000
SigBlk:0000000000000000
SigIgn:0000000000000000
SigCgt:ffffffffffc1feff
CapInh:0000000000000000
CapPrm:0000000000000000
CapEff:0000000000000000
CapBnd:0000001fffffffff
CapAmb:0000000000000000
Seccomp:0
Speculation_Store_Bypass:thread vulnerable
Cpus_allowed:ff,ffffffff
Cpus_allowed_list:0-39
Mems_allowed:00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000003
Mems_allowed_list:0-1
voluntary_ctxt_switches:42023
nonvoluntary_ctxt_switches:125