当前位置:   article > 正文

linux进程管理杂记(1)

kauditd rsyslogd

进程命令

pstree

CentOS7显示进程树

  1. [root@CentOS7 tmp]# pstree
  2. systemd─┬─NetworkManager─┬─dhclient
  3. │ └─2*[{NetworkManager}]
  4. ├─abrt-watch-log
  5. ├─abrtd
  6. ├─atd
  7. ├─auditd───{auditd}
  8. ├─crond
  9. ├─dbus-daemon───{dbus-daemon}
  10. ├─dhclient
  11. ├─firewalld───{firewalld}
  12. ├─login───bash
  13. ├─lsmd
  14. ├─lvmetad
  15. ├─master─┬─pickup
  16. │ └─qmgr
  17. ├─polkitd───5*[{polkitd}]
  18. ├─rsyslogd───2*[{rsyslogd}]
  19. ├─smartd
  20. ├─sshd─┬─sshd───bash───pstree
  21. │ └─sshd───bash───man───less
  22. ├─systemd-journal
  23. ├─systemd-logind
  24. ├─systemd-udevd
  25. ├─tuned───4*[{tuned}]
  26. └─wpa_supplicant

CentOS7显示进程树

  1. [root@zz ~]# pstree
  2. init─┬─abrtd
  3. ├─acpid
  4. ├─atd
  5. ├─auditd───{auditd}
  6. ├─automount───4*[{automount}]
  7. ├─certmonger
  8. ├─console-kit-dae───63*[{console-kit-da}]
  9. ├─crond
  10. ├─cupsd
  11. ├─dbus-daemon
  12. ├─dhclient
  13. ├─hald─┬─hald-runner─┬─hald-addon-acpi
  14. │ │ ├─hald-addon-inpu
  15. │ │ └─hald-addon-rfki
  16. │ └─{hald}
  17. ├─httpd───8*[httpd]
  18. ├─login───bash
  19. ├─master─┬─pickup
  20. │ └─qmgr
  21. ├─mcelog
  22. ├─5*[mingetty]
  23. ├─mysqld_safe───mysqld───9*[{mysqld}]
  24. ├─rpc.statd
  25. ├─rpcbind
  26. ├─rsyslogd───3*[{rsyslogd}]
  27. ├─sshd───sshd───bash───pstree
  28. ├─udevd───2*[udevd]
  29. └─vsftpd

ps

显示与终端有关的进程

  1. [root@zz ~]# ps a
  2. PID TTY STAT TIME COMMAND
  3. 1915 tty2 Ss+ 0:00 /sbin/mingetty /dev/tty2
  4. 1917 tty3 Ss+ 0:00 /sbin/mingetty /dev/tty3
  5. 1920 tty4 Ss+ 0:00 /sbin/mingetty /dev/tty4
  6. 1926 tty5 Ss+ 0:00 /sbin/mingetty /dev/tty5
  7. 1935 tty6 Ss+ 0:00 /sbin/mingetty /dev/tty6
  8. 2017 tty1 Ss+ 0:01 -bash
  9. 15342 pts/0 Ss 0:00 -bash
  10. 15474 pts/0 R+ 0:00 ps a

显示与终端无关的进程

  1. [root@zz ~]# ps x
  2. PID TTY STAT TIME COMMAND
  3. 1 ? Ss 0:18 /sbin/init
  4. 2 ? S 0:00 [kthreadd]
  5. 3 ? S 0:00 [migration/0]
  6. 4 ? S 1:40 [ksoftirqd/0]
  7. 5 ? S 0:00 [stopper/0]
  8. 6 ? S 0:34 [watchdog/0]
  9. 7 ? S 10:59 [events/0]
  10. 8 ? S 0:00 [events/0]
  11. 9 ? S 0:00 [events_long/0]
  12. 10 ? S 0:00 [events_power_ef]
  13. 11 ? S 0:00 [cgroup]
  14. 12 ? S 0:00 [khelper]
  15. 13 ? S 0:00 [netns]
  16. 14 ? S 0:00 [async/mgr]
  17. 15 ? S 0:00 [pm]
  18. 16 ? S 0:10 [sync_supers]
  19. 17 ? S 0:13 [bdi-default]
  20. 18 ? S 0:00 [kintegrityd/0]
  21. 19 ? S 0:16 [kblockd/0]
  22. 20 ? S 0:00 [kacpid]
  23. 21 ? S 0:00 [kacpi_notify]
  24. 22 ? S 0:00 [kacpi_hotplug]
  25. 23 ? S 0:00 [ata_aux]
  26. 24 ? S 0:00 [ata_sff/0]
  27. 25 ? S 0:00 [ksuspend_usbd]
  28. 26 ? S 0:07 [khubd]
  29. 27 ? S 0:00 [kseriod]
  30. 28 ? S 0:00 [md/0]
  31. 29 ? S 0:00 [md_misc/0]
  32. 30 ? S 0:00 [linkwatch]
  33. 33 ? S 0:01 [khungtaskd]
  34. 34 ? S 0:17 [kswapd0]
  35. 35 ? SN 0:00 [ksmd]
  36. 36 ? S 0:00 [aio/0]
  37. 37 ? S 0:00 [crypto/0]
  38. 44 ? S 0:00 [kthrotld/0]
  39. 45 ? S 0:00 [pciehpd]
  40. 47 ? S 0:00 [kpsmoused]
  41. 48 ? S 0:00 [usbhid_resumer]
  42. 49 ? S 0:00 [deferwq]
  43. 81 ? S 0:00 [kdmremove]
  44. 82 ? S 0:00 [kstriped]
  45. 113 ? S 0:00 [ttm_swap]
  46. 242 ? S 0:00 [scsi_eh_0]
  47. 246 ? S 0:00 [scsi_eh_1]
  48. 266 ? S 1:08 [mpt_poll_0]
  49. 267 ? S 0:00 [mpt/0]
  50. 268 ? S 0:00 [scsi_eh_2]
  51. 363 ? S 0:12 [flush-8:0]
  52. 416 ? S 0:02 [jbd2/sda5-8]
  53. 417 ? S 0:00 [ext4-dio-unwrit]
  54. 509 ? S<s 0:02 /sbin/udevd -d
  55. 645 ? S 0:54 [vmmemctl]
  56. 802 ? S 0:00 [bluetooth]
  57. 869 ? S 0:00 [jbd2/sda1-8]
  58. 870 ? S 0:00 [ext4-dio-unwrit]
  59. 871 ? S 0:00 [jbd2/sda7-8]
  60. 872 ? S 0:00 [ext4-dio-unwrit]
  61. 873 ? S 0:00 [jbd2/sda8-8]
  62. 874 ? S 0:00 [ext4-dio-unwrit]
  63. 875 ? S 0:01 [jbd2/sda6-8]
  64. 876 ? S 0:00 [ext4-dio-unwrit]
  65. 877 ? S 0:00 [jbd2/sda3-8]
  66. 878 ? S 0:00 [ext4-dio-unwrit]
  67. 879 ? S 0:19 [jbd2/sda2-8]
  68. 880 ? S 0:00 [ext4-dio-unwrit]
  69. 923 ? S 0:00 [kauditd]
  70. 1207 ? S<sl 0:03 auditd
  71. 1241 ? Sl 0:03 /sbin/rsyslogd -i /var/run/syslogd.pi
  72. 1369 ? Ss 0:00 cupsd -C /etc/cups/cupsd.conf
  73. 1401 ? Ss 0:00 /usr/sbin/acpid
  74. 1414 ? S 0:00 hald-runner
  75. 1446 ? S 0:00 hald-addon-input: Listening on /dev/i
  76. 1488 ? Ssl 0:17 automount --pid-file /var/run/autofs.
  77. 1524 ? Ss 0:00 /usr/sbin/mcelog --daemon
  78. 1541 ? Ss 0:01 /usr/sbin/sshd
  79. 1578 ? S 0:00 /bin/sh /usr/bin/mysqld_safe --datadi
  80. 1799 ? Ss 0:09 /usr/libexec/postfix/master
  81. 1828 ? Ss 0:00 /usr/sbin/abrtd
  82. 1839 ? Ss 1:29 /usr/sbin/httpd
  83. 1851 ? Ss 0:06 crond
  84. 1866 ? Ss 0:00 /usr/sbin/atd
  85. 1882 ? Ss 0:01 /usr/sbin/certmonger -S -p /var/run/c
  86. 1912 ? Ss 0:00 login -- root
  87. 1915 tty2 Ss+ 0:00 /sbin/mingetty /dev/tty2
  88. 1917 tty3 Ss+ 0:00 /sbin/mingetty /dev/tty3
  89. 1920 tty4 Ss+ 0:00 /sbin/mingetty /dev/tty4
  90. 1926 tty5 Ss+ 0:00 /sbin/mingetty /dev/tty5
  91. 1935 tty6 Ss+ 0:00 /sbin/mingetty /dev/tty6
  92. 1950 ? Sl 0:00 /usr/sbin/console-kit-daemon --no-dae
  93. 2017 tty1 Ss+ 0:01 -bash
  94. 6563 ? Ss 0:04 dhclient
  95. 12320 ? S< 0:02 /sbin/udevd -d
  96. 12321 ? S< 0:00 /sbin/udevd -d
  97. 13048 ? S 0:00 /usr/libexec/hald-addon-rfkill-killsw
  98. 13492 ? Ss 0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.c
  99. 15340 ? Rs 0:02 sshd: root@pts/0
  100. 15342 pts/0 Ss 0:00 -bash
  101. 15475 pts/0 R+ 0:00 ps x

以用户为中心显示所有进程

[root@zz ~]# ps aux

显示完整格式的所有进程

  1. [root@zz ~]# ps -ef
  2. UID PID PPID C STIME TTY TIME CMD
  3. root 1 0 0 Jun15 ? 00:00:18 /sbin/init
  4. root 2 0 0 Jun15 ? 00:00:00 [kthreadd]
  5. root 3 2 0 Jun15 ? 00:00:00 [migration/0]
  6. root 4 2 0 Jun15 ? 00:01:41 [ksoftirqd/0]
  7. root 5 2 0 Jun15 ? 00:00:00 [stopper/0]

显示所有任务格式的进程

  1. [root@zz ~]# ps -ej
  2. PID PGID SID TTY TIME CMD
  3. 1 1 1 ? 00:00:18 init
  4. 2 0 0 ? 00:00:00 kthreadd
  5. 3 0 0 ? 00:00:00 migration/0
  6. 4 0 0 ? 00:01:41 ksoftirqd/0
  7. 5 0 0 ? 00:00:00 stopper/0
  8. 6 0 0 ? 00:00:35 watchdog/0
  9. 7 0 0 ? 00:12:17 events/0
  10. 8 0 0 ? 00:00:00 events/0

树状显示任务格式的所有进程

  1. [root@zz ~]# ps -ejH
  2. PID PGID SID TTY TIME CMD
  3. 2 0 0 ? 00:00:00 kthreadd
  4. 3 0 0 ? 00:00:00 migration/0
  5. 4 0 0 ? 00:01:41 ksoftirqd/0
  6. 5 0 0 ? 00:00:00 stopper/0
  7. 6 0 0 ? 00:00:35 watchdog/0
  8. 7 0 0 ? 00:12:17 events/0
  9. 8 0 0 ? 00:00:00 events/0
  10. 9 0 0 ? 00:00:00 events_long/0
  11. 10 0 0 ? 00:00:00 events_power_ef
  12. 11 0 0 ? 00:00:00 cgroup
  13. 12 0 0 ? 00:00:00 khelper
  14. 13 0 0 ? 00:00:00 netns
  15. 14 0 0 ? 00:00:00 async/mgr
  16. 15 0 0 ? 00:00:00 pm
  17. 16 0 0 ? 00:00:10 sync_supers
  18. 17 0 0 ? 00:00:14 bdi-default
  19. 18 0 0 ? 00:00:00 kintegrityd/0
  20. 19 0 0 ? 00:00:16 kblockd/0
  21. 20 0 0 ? 00:00:00 kacpid
  22. 21 0 0 ? 00:00:00 kacpi_notify
  23. 22 0 0 ? 00:00:00 kacpi_hotplug
  24. 23 0 0 ? 00:00:00 ata_aux
  25. 24 0 0 ? 00:00:00 ata_sff/0
  26. 25 0 0 ? 00:00:00 ksuspend_usbd
  27. 26 0 0 ? 00:00:07 khubd
  28. 27 0 0 ? 00:00:00 kseriod
  29. 28 0 0 ? 00:00:00 md/0
  30. 29 0 0 ? 00:00:00 md_misc/0
  31. 30 0 0 ? 00:00:00 linkwatch
  32. 33 0 0 ? 00:00:01 khungtaskd
  33. 34 0 0 ? 00:00:17 kswapd0
  34. 35 0 0 ? 00:00:00 ksmd
  35. 36 0 0 ? 00:00:00 aio/0
  36. 37 0 0 ? 00:00:00 crypto/0
  37. 44 0 0 ? 00:00:00 kthrotld/0
  38. 45 0 0 ? 00:00:00 pciehpd
  39. 47 0 0 ? 00:00:00 kpsmoused
  40. 48 0 0 ? 00:00:00 usbhid_resumer
  41. 49 0 0 ? 00:00:00 deferwq
  42. 81 0 0 ? 00:00:00 kdmremove
  43. 82 0 0 ? 00:00:00 kstriped
  44. 113 0 0 ? 00:00:00 ttm_swap
  45. 242 0 0 ? 00:00:00 scsi_eh_0
  46. 246 0 0 ? 00:00:00 scsi_eh_1
  47. 266 0 0 ? 00:01:12 mpt_poll_0
  48. 267 0 0 ? 00:00:00 mpt/0
  49. 268 0 0 ? 00:00:00 scsi_eh_2
  50. 363 0 0 ? 00:00:13 flush-8:0
  51. 416 0 0 ? 00:00:02 jbd2/sda5-8
  52. 417 0 0 ? 00:00:00 ext4-dio-unwrit
  53. 645 0 0 ? 00:00:58 vmmemctl
  54. 802 0 0 ? 00:00:00 bluetooth
  55. 869 0 0 ? 00:00:00 jbd2/sda1-8
  56. 870 0 0 ? 00:00:00 ext4-dio-unwrit
  57. 871 0 0 ? 00:00:00 jbd2/sda7-8
  58. 872 0 0 ? 00:00:00 ext4-dio-unwrit
  59. 873 0 0 ? 00:00:00 jbd2/sda8-8
  60. 874 0 0 ? 00:00:00 ext4-dio-unwrit
  61. 875 0 0 ? 00:00:01 jbd2/sda6-8
  62. 876 0 0 ? 00:00:00 ext4-dio-unwrit
  63. 877 0 0 ? 00:00:00 jbd2/sda3-8
  64. 878 0 0 ? 00:00:00 ext4-dio-unwrit
  65. 879 0 0 ? 00:00:21 jbd2/sda2-8
  66. 880 0 0 ? 00:00:00 ext4-dio-unwrit
  67. 923 0 0 ? 00:00:00 kauditd
  68. 1 1 1 ? 00:00:18 init
  69. 509 509 509 ? 00:00:02 udevd
  70. 12320 509 509 ? 00:00:02 udevd
  71. 12321 509 509 ? 00:00:00 udevd
  72. 1207 1207 1207 ? 00:00:03 auditd
  73. 1241 1235 924 ? 00:00:03 rsyslogd
  74. 1292 1292 1292 ? 00:00:03 rpcbind
  75. 1314 1314 1314 ? 00:00:00 rpc.statd
  76. 1348 1348 1348 ? 00:00:01 dbus-daemon
  77. 1369 1369 1369 ? 00:00:00 cupsd
  78. 1401 1401 1401 ? 00:00:00 acpid
  79. 1413 1413 1413 ? 00:00:10 hald
  80. 1414 1413 1413 ? 00:00:00 hald-runner
  81. 1446 1413 1413 ? 00:00:00 hald-addon-inpu
  82. 1464 1413 1413 ? 00:00:00 hald-addon-acpi
  83. 13048 1413 1413 ? 00:00:00 hald-addon-rfki
  84. 1488 1488 1488 ? 00:00:19 automount
  85. 1524 1524 1524 ? 00:00:00 mcelog
  86. 1541 1541 1541 ? 00:00:01 sshd
  87. 15340 15340 15340 ? 00:00:03 sshd
  88. 15342 15342 15342 pts/0 00:00:00 bash
  89. 16685 16685 15342 pts/0 00:00:00 ps
  90. 1578 1546 924 ? 00:00:00 mysqld_safe
  91. 1682 1546 924 ? 00:04:16 mysqld
  92. 1799 1799 1799 ? 00:00:10 master
  93. 1810 1799 1799 ? 00:00:01 qmgr
  94. 16656 1799 1799 ? 00:00:00 pickup
  95. 1828 1828 1828 ? 00:00:00 abrtd
  96. 1839 1839 1839 ? 00:01:34 httpd
  97. 1939 1839 1839 ? 00:00:00 httpd
  98. 1940 1839 1839 ? 00:00:00 httpd
  99. 1941 1839 1839 ? 00:00:00 httpd
  100. 1942 1839 1839 ? 00:00:00 httpd
  101. 1943 1839 1839 ? 00:00:00 httpd
  102. 1944 1839 1839 ? 00:00:00 httpd
  103. 1945 1839 1839 ? 00:00:00 httpd
  104. 1946 1839 1839 ? 00:00:00 httpd
  105. 1851 1851 1851 ? 00:00:06 crond
  106. 1866 1866 1866 ? 00:00:00 atd
  107. 1882 1882 1882 ? 00:00:01 certmonger
  108. 1912 1912 1912 ? 00:00:00 login
  109. 2017 2017 2017 tty1 00:00:01 bash
  110. 1915 1915 1915 tty2 00:00:00 mingetty

以进程层级格式显示进程相关信息

  1. [root@zz ~]# ps -eFH | head
  2. UID PID PPID C SZ RSS PSR STIME TTY TIME CMD
  3. root 2 0 0 0 0 0 Jun15 ? 00:00:00 [kthreadd]
  4. root 3 2 0 0 0 0 Jun15 ? 00:00:00 [migration/0]
  5. root 4 2 0 0 0 0 Jun15 ? 00:01:41 [ksoftirqd/0]
  6. root 5 2 0 0 0 0 Jun15 ? 00:00:00 [stopper/0]
  7. root 6 2 0 0 0 0 Jun15 ? 00:00:35 [watchdog/0]

查看selinux进程信息

  1. [root@qq ~]# ps axZ | head
  2. LABEL PID TTY STAT TIME COMMAND
  3. system_u:system_r:init_t:s0 1 ? Ss 0:58 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
  4. system_u:system_r:kernel_t:s0 2 ? S 0:00 [kthreadd]
  5. system_u:system_r:kernel_t:s0 3 ? S 0:04 [ksoftirqd/0]
  6. system_u:system_r:kernel_t:s0 7 ? S 0:00 [migration/0]
  7. system_u:system_r:kernel_t:s0 8 ? S 0:00 [rcu_bh]
  8. system_u:system_r:kernel_t:s0 9 ? S 0:00 [rcuob/0]
  9. system_u:system_r:kernel_t:s0 10 ? S 0:00 [rcuob/1]
  10. system_u:system_r:kernel_t:s0 11 ? S 0:00 [rcuob/2]
  11. system_u:system_r:kernel_t:s0 12 ? S 0:00 [rcuob/3]

只显示root的进程信息

  1. [root@qq ~]# ps -U root | head
  2. PID TTY TIME CMD
  3. 1 ? 00:00:58 systemd
  4. 2 ? 00:00:00 kthreadd
  5. 3 ? 00:00:04 ksoftirqd/0
  6. 7 ? 00:00:00 migration/0
  7. 8 ? 00:00:00 rcu_bh
  8. 9 ? 00:00:00 rcuob/0
  9. 10 ? 00:00:00 rcuob/1
  10. 11 ? 00:00:00 rcuob/2
  11. 12 ? 00:00:00 rcuob/3

通过-o参数只显示相关列信息

  1. [root@qq ~]# ps axo pid,psr,command | head
  2. PID PSR COMMAND
  3. 1 0 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
  4. 2 0 [kthreadd]
  5. 3 0 [ksoftirqd/0]
  6. 7 0 [migration/0]
  7. 8 0 [rcu_bh]
  8. 9 0 [rcuob/0]
  9. 10 0 [rcuob/1]
  10. 11 0 [rcuob/2]
  11. 12 0 [rcuob/3]

pgrep和pkill

pgrep只显示进程号

  1. [root@qq ~]# pgrep -u root | head
  2. 1
  3. 2
  4. 3
  5. 7
  6. 8
  7. 9
  8. 10
  9. 11
  10. 12
  11. 13

pgrep只显示进程号和进程名

  1. [root@qq ~]# pgrep -u root -l | head -20
  2. 1 systemd
  3. 2 kthreadd
  4. 3 ksoftirqd/0
  5. 7 migration/0
  6. 8 rcu_bh
  7. 9 rcuob/0
  8. 10 rcuob/1
  9. 11 rcuob/2
  10. 12 rcuob/3
  11. 13 rcuob/4
  12. 14 rcuob/5
  13. 15 rcuob/6
  14. 16 rcuob/7
  15. 17 rcu_sched
  16. 18 rcuos/0
  17. 19 rcuos/1
  18. 20 rcuos/2
  19. 21 rcuos/3
  20. 22 rcuos/4
  21. 23 rcuos/5

pgrep只显示进程号的进程全名,包括使用的参数

  1. [root@qq ~]# pgrep -u root -a
  2. 1 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
  3. 2 kthreadd
  4. 3 ksoftirqd/0
  5. 7 migration/0
  6. 8 rcu_bh
  7. 9 rcuob/0
  8. 10 rcuob/1
  9. 11 rcuob/2
  10. 12 rcuob/3
  11. 13 rcuob/4
  12. 14 rcuob/5
  13. 15 rcuob/6
  14. 16 rcuob/7
  15. 17 rcu_sched
  16. 18 rcuos/0
  17. 19 rcuos/1
  18. 20 rcuos/2
  19. 21 rcuos/3
  20. 22 rcuos/4
  21. 23 rcuos/5
  22. 24 rcuos/6
  23. 25 rcuos/7
  24. 26 watchdog/0
  25. 27 khelper
  26. 28 kdevtmpfs
  27. 29 netns
  28. 30 perf
  29. 31 writeback
  30. 32 kintegrityd
  31. 33 bioset
  32. 34 kblockd
  33. 35 md
  34. 40 khungtaskd
  35. 41 kswapd0
  36. 42 ksmd
  37. 43 fsnotify_mark
  38. 44 crypto
  39. 52 kthrotld
  40. 54 kmpath_rdacd
  41. 55 kpsmoused
  42. 57 ipv6_addrconf
  43. 77 deferwq
  44. 108 kauditd
  45. 244 ata_sff
  46. 245 scsi_eh_0
  47. 246 scsi_tmf_0
  48. 247 scsi_eh_1
  49. 248 scsi_tmf_1
  50. 252 mpt_poll_0
  51. 253 mpt/0
  52. 255 events_power_ef
  53. 261 scsi_eh_2
  54. 262 scsi_tmf_2
  55. 264 ttm_swap
  56. 283 xfsalloc
  57. 284 xfs_mru_cache
  58. 285 xfs-buf/sda6
  59. 286 xfs-data/sda6
  60. 287 xfs-conv/sda6
  61. 288 xfs-cil/sda6
  62. 289 xfsaild/sda6
  63. 311 xfs-buf/sda5
  64. 312 xfs-data/sda5
  65. 313 xfs-conv/sda5
  66. 314 xfs-cil/sda5
  67. 315 xfsaild/sda5
  68. 373 /usr/lib/systemd/systemd-journald
  69. 387 /usr/sbin/lvmetad -f
  70. 401 /usr/lib/systemd/systemd-udevd

pidof

  1. 根据进程名获取pid
  2. [root@qq ~]# pidof sshd
  3. 11127 1184

top

top

P:以占率的CPU百分比:
M:占率内存百分比;
T:累积占率CPU时常

top修改刷新时间间隔

  1. top - 05:51:44 up 19:27, 2 users, load average: 0.00, 0.01, 0
  2. Tasks: 132 total, 2 running, 130 sleeping, 0 stopped, 0 z
  3. %Cpu(s): 0.0 us, 1.0 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.0 hi,
  4. KiB Mem : 500148 total, 12888 free, 141488 used, 34577
  5. KiB Swap: 4194300 total, 4193364 free, 936 used. 30878
  6. Change delay from 1.0 to
  7. PID USER PR NI VIRT RES SHR S %CPU %MEM
  8. 1 root 20 0 126560 7384 2632 S 0.0 1.5
  9. 2 root 20 0 0 0 0 S 0.0 0.0
  10. 3 root 20 0 0 0 0 S 0.0 0.0
  11. 7 root rt 0 0 0 0 S 0.0 0.0
  12. 8 root 20 0 0 0 0 S 0.0 0.0
  13. 9 root 20 0 0 0 0 S 0.0

通过q命令kill掉top命令中的进程

  1. top - 05:52:43 up 19:28, 2 users, load average: 0.00, 0.01, 0
  2. Tasks: 132 total, 3 running, 129 sleeping, 0 stopped, 0 z
  3. %Cpu(s): 0.3 us, 0.5 sy, 0.0 ni, 99.1 id, 0.1 wa, 0.0 hi,
  4. KiB Mem : 500148 total, 12776 free, 141600 used, 34577
  5. KiB Swap: 4194300 total, 4193364 free, 936 used. 30867
  6. PID to signal/kill [default pid = 11925]
  7. PID USER PR NI VIRT RES SHR S %CPU %MEM
  8. 11925 root 20 0 146160 1920 1360 R 6.2 0.4
  9. 1 root 20 0 126560 7384 2632 S 0.0 1.5
  10. 2 root 20 0 0 0 0 S 0.0 0.0

top每一秒刷新一次

[root@qq ~]# top -d 1

top从上到下批次显示所有进程

[root@qq ~]# top -b

top只显示3批进程后结束

[root@qq ~]# top -b -n 3

htop

转载于:https://blog.51cto.com/zhongle21/2091430

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/968964
推荐阅读
相关标签
  

闽ICP备14008679号