pgrep:查看当前正在运行的进程。
命令格式:pgrep [options] pattern
常用选项:
-u uid:effective user,仅匹配列出其有效用户ID的进程。
-U uid:real user,仅匹配列出真实用户ID的进程。
-t terminal:与指定终端相关的进程
-l:列出进程名称以及进程ID(仅限pgrep)
-a:显示完整格式的进程名
-P pid:显示指定进程的子进程
[root@centos7 ~]#pgrep -lu root
1 systemd
2 kthreadd
4 kworker/0:0H
5 kworker/u256:0
6 ksoftirqd/0
7 migration/0
8 rcu_bh
9 rcu_sched
10 lru-add-drain
11 watchdog/0
12 watchdog/1
13 migration/1
14 ksoftirqd/1
16 kworker/1:0H
18 kdevtmpfs
19 netns
20 khungtaskd
21 writeback
22 kintegrityd
23 bioset
24 bioset
25 bioset
26 kblockd
27 md
28 edac-poller
29 watchdogd
31 kworker/1:1
36 kswapd0
37 ksmd
38 khugepaged
39 crypto
47 kthrotld
49 kmpath_rdacd
50 kaluad
51 kpsmoused
54 ipv6_addrconf
67 deferwq
103 kauditd
245 nfit
246 mpt_poll_0
247 mpt/0
248 ata_sff
249 scsi_eh_0
250 scsi_tmf_0
253 scsi_eh_1
254 kworker/u256:2
255 scsi_tmf_1
256 scsi_eh_2
257 scsi_tmf_2
259 irq/16-vmwgfx
261 ttm_swap
289 bioset
290 xfsalloc
291 xfs_mru_cache
292 xfs-buf/sda2
293 xfs-data/sda2
294 xfs-conv/sda2
295 xfs-cil/sda2
296 xfs-reclaim/sda
297 xfs-log/sda2
298 xfs-eofblocks/s
299 xfsaild/sda2
300 kworker/1:1H
379 systemd-journal
408 systemd-udevd
528 kworker/0:1H
565 xfs-buf/sda3
566 xfs-data/sda3
567 xfs-conv/sda3
572 xfs-cil/sda3
574 xfs-reclaim/sda
575 xfs-log/sda3
578 xfs-eofblocks/s
585 xfsaild/sda3
657 jbd2/sda1-8
658 ext4-rsv-conver
712 auditd
767 abrtd
769 abrt-watch-log
772 irqbalance
779 VGAuthService
781 vmtoolsd
782 systemd-logind
796 NetworkManager
809 atd
814 crond
825 login
1282 tuned
1283 rsyslogd
1284 automount
1447 master
1542 bash
1563 sshd
1565 bash
1745 kworker/1:2
2103 kworker/0:1
2162 kworker/0:3
2181 kworker/u256:1
2184 kworker/0:0