tasklist查看指定进程_Linux Top查看指定进程的CPU状态

ad80f623afec0e1a810f6df305785f8f.png

查看top帮助信息

不管linux还是unix,大多数命令都是支持man命令来查看帮助信息的。

语法是下面这样,进入到交互界面后,用法类似vi,然后按「q」可以退出,输入「?」再输入关键字,可以查询相关关键字:

man top

帮助信息回显:

TOP(1)                                                                                                                       User Commands                                                                                                                       TOP(1)

NAME
       top - display Linux processes

SYNOPSIS
       top -hv|-bcHiOSs -d secs -n max -u|U user -p pid -o fld -w [cols]
·····

·····
       -p  :Monitor-PIDs mode as:  -pN1 -pN2 ...  or  -pN1,N2,N3 ...
            Monitor only processes with specified process IDs.  This option can be given up to 20 times, or you can provide a comma delimited list with up to 20 pids.  Co-mingling both approaches is permitted.

            A pid value of zero will be treated as the process id of the top program itself once it is running.

            This is a command-line option only and should you wish to return to normal operation, it is not necessary to quit and restart top  --  just issue any of these interactive commands: '=', 'u' or 'U'.

            The 'p', 'u' and 'U' command-line options are mutually exclusive.

执行命令

找到帮忙信息之后,在「top」后面接上参数 「-p」就可以,还可以接多个这样的参数。下面是实例。

top -p222 -p235

结果预览

top - 10:59:27 up 8 days, 23:04, 33 users,  load average: 19.29, 18.88, 15.68
Tasks:   2 total,   0 running,   2 sleeping,   0 stopped,   0 zombie
%Cpu(s): 28.0 us,  2.2 sy,  0.0 ni, 66.1 id,  3.5 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem:  13192180+total, 12092056+used, 11001252 free, 58405476 buffers
KiB Swap: 13410816+total,    75264 used, 13403289+free. 34504364 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                                                                                                  
  222 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/42:0H                                                                                                                                                                                            
  235 root      20   0       0      0      0 S   0.0  0.0   0:01.74 ksoftirqd/45

小结

遇到不会的Linux命令,不要慌、莫着急,用「man」查看帮助信息,帮忙信息太多,可以用用「/」或者「?」加上关键字可以搜索,可以说非常方便。还有一点就是多实践操作。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值