UNPKG

1.23 kBMarkdownView Raw
1pgrep
2===
3
4根据用户给出的信息在当前运行进程中查找并列出符合条件的进程ID(PID)
5
6## 补充说明
7
8**pgrep命令** 以名称为依据从运行进程队列中查找进程,并显示查找到的进程id。每一个进程ID以一个十进制数表示,通过一个分割字符串和下一个ID分开,默认的分割字符串是一个新行。对于每个属性选项,用户可以在命令行上指定一个以逗号分割的可能值的集合。
9
10### 语法
11
12```shell
13pgrep(选项)(参数)
14```
15
16### 选项
17
18```shell
19-o:仅显示找到的最小(起始)进程号;
20-n:仅显示找到的最大(结束)进程号;
21-l:显示进程名称;
22-P:指定父进程号;
23-g:指定进程组;
24-t:指定开启进程的终端;
25-u:指定进程的有效用户ID。
26```
27
28### 参数
29
30进程名称:指定要查找的进程名称,同时也支持类似grep指令中的匹配模式。
31
32### 实例
33
34```shell
35pgrep -lo httpd
364557 httpd
37 [root@localhost ~]# pgrep -ln httpd
384566 httpd
39
40[root@localhost ~]# pgrep -l httpd
414557 httpd
424560 httpd
434561 httpd
444562 httpd
454563 httpd
464564 httpd
474565 httpd
484566 httpd
49
50[root@localhost ~]# pgrep httpd 4557
514560
524561
534562
544563
554564
564565
574566
58```
59
60
61