【linux命令学习】之top/ps

【linux命令学习】之top

先上man:

name: top - display Linux tasks

synopsis: top -hv | -bcHisS -d delay -n iterations -p pid [, pid ...]

description:The  top  program  provides  a dynamic real-time view of a running system.  It can display system summary information as well as a list of tasks
        currently being managed by the Linux kernel.  The types of system summaryinformation shownand the types, order and size  of  information  dis-
    played for tasks are all user configurableand that configuration can be made persistent across restarts.
显示的信息是可以配置的,而且重启后仍能生效。

        The program provides a limited interactive interface for process manipulation as well as a much more extensive interface for personal configura-
        tion  --  encompassing every aspect of its operation.  And while top is referred to throughout this document, you are free to name  the  program
        anything  you wish.  That new name, possibly an alias, will then be reflected on top's display and used when reading and writing a configuration
        file.

提供有限的交互

top相关操作(参数说明):

使用'h'或者?来获取帮助,使用'q'退出top或者用ctrl^c进行”暴力退出“。


top界面:

分为4个部分:1、Summary2、Message/Prompt行3、列名4、Task


top启动参数语法:

top -hv | -bcHisS -d delay -n iterations -p pid [, pid ...]

-h:显示帮助

-v:显示版本后退出

-b:批处理模式。将top的输出结果发送到其他程序或者文件中。在这个模式下,top将不接受任何输出。

-c:命令行/程序名切换。启动top时将切换上次记住的c的状态。如上次为命令行,则本次启动为程序名。

-H:线程。和c一样,也是个状态切换指令,带有此参数将会切换上次记录的H状态。

-i:闲置进程。是否显示闲置进程,也是个切换命令。

-s:安全模式。启动时将强制开启此模式。

-S:累积时间模式。

-d:时延设置。后面紧跟时间,时间格式为:ss.tt(second.tenths)。设定刷新时延。在交互命令中可以使用d或s进行修改。

-n:循环次数。最大循环次数,当达到时top将退出。

-p:监控pid。监控指定进程,使用pid,最多可以监控20个进程。


栏位显示:

a:PID-进程id

b:PPID-父进程ID

c:RUSER-实际用户名

d:UID-用户ID

e:USER-用户名

f:GROUP-组名

g:TTY-控制TTy。控制终端的名称。通常为进程发起设备(串口、pty等)。当显示?则表没有终端。

h:PR-优先级

i:NI-Nice值。

wikipedia中对Nice的解释

  
  
Nice值是类UNIX操作系统中表示静态优先级的数值。每个进程都有自己的静态优先级,优先级高的进程得以优先运行。Nice值的范围是-20~+19,拥有Nice值越大的进程的实际优先级越小(即Nice值为+19的进程优先级最小,为-20的进程优先级最大),默认的Nice值是0。由于Nice值是静态优先级,所以一经设定,就不会再被内核修改,直到被重新设定。Nice值只起干预CPU时间分配的作用,实际中的细节,由动态优先级决定。
j:P-CPU使用。

k:CPU使用率

l:TIME-CPU时间。在累计时间模式下,每个进程都会记录自己的CPU时间(自己及自己子进程使用的时间)。
m:TIME+-CPU时间

n:MEM-内存使用率

o:VIRT-虚拟内存。

p:SWAP-


待续。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值