linux命令嵌套实例(六)top命令详解

9、top命令的相关嵌套。top命令的作用为display Linux processes,即列出linux进程。
The  top  program  provides a dynamic real-time view of a running system.top程序提供运行系统的动态实时视窗(信息)。
 It can display system summary information as well as  a  list  of  processes  or threads  currently  being  managed  by the Linux kernel. 它可以显示系统概要信息,也可以显示进程列表或当前由Linux内核管理的线程。
The types of system summary information shown and the types, order and size of  information  dis‐played  for processes are all user configurable and 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 configuration  -- 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命令被提交自始至终所得的所有记录,你都可以自由地随意命名(这些程序)。该新名称,可能是别名,将被映射到top的视窗上,并在读取和写入配置文件时使用。
关于这些系统手册中所说明的功能,我也不是很了解,也希望大家多多发言,经常探讨,以便日后更新。
(A)现在先让我们来看一个实例:
top -d 2 | grep i
  2768 i  20   0 1479280 162636  49400 S 20.0 12.3   0:58.73 gnome-shell      
  3423 i  20   0  575796  25652  14800 S  5.0  1.9   0:09.17 gnome-terminal- 
查看i用户的实时进程使用,每2秒更新一次。

(B)Show library version and the usage prompt, then quit.显示库版本和使用提示,然后退出。使用-h或-v,例如:
top -h
  procps-ng version 3
Usage:
  top -hv | -bcHiOSs -d secs -n max -u|U user -p pid(s) -o field -w [cols]
 top -v
  procps-ng version 3
Usage:
  top -hv | -bcHiOSs -d secs -n max -u|U user -p pid(s) -o field -w [cols]
top -hv
  procps-ng version 3
Usage:
  top -hv | -bcHiOSs -d secs -n max -u|U user -p pid(s) -o field -w [cols]

(C)开启top命令批处理模式。使用-b:
top - 11:05:35 up  1:16,  3 users,  load average: 0.21, 0.16, 0.23
Tasks: 167 total,   1 running, 166 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.3 us,  1.9 sy,  0.0 ni, 94.3 id,  0.4 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1325568 total,   102076 free,   610960 used,   612532 buff/cache
KiB Swap:  2097148 total,  2097148 free,        0 used.   486932 avail Mem
   PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
  4793 root      20   0  157704   2056   1488 R  7.1  0.2   0:00.15 top
     9 root      20   0       0      0      0 S  3.6  0.0   0:02.65 rcu_sched
     1 root      20   0  128092   6716   3964 S  0.0  0.5   0:06.49 systemd
     2 root      20   0       0      0      0 S  0.0  0.0   0:00.01 kthreadd

相关内容还很多,想看更新请点赞吧!




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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值