5、pgrep 查找进程PID
1、pgrep 命令
根据用户给出的信息在当前运行进程中查找并列出符合条件的进程ID(PID)。
语法:
pgrep (选项) 进程名称
选项:
-l, --list-name 同时列出进程名和PID -i, --ignore-case 忽略大小写 -f, --full 匹配完整命令行(而不只是进程名) -u, --euid 匹配有效用户ID或用户名 -x, --exact 精确匹配整个进程名 -n, --newest 仅显示找到的最大(结束)进程号; -o, --oldest 仅显示找到的最小(起始)进程号; -c, --count 只显示匹配的进程数量
-P 指定父进程号;
-g 指定进程组;
-t 指定开启进程的终端;
例子:
[root@localhost ~]# pgrep -l more 2493 more [root@localhost ~]# pgrep -l ls 770 alsactl 789 vmtoolsd 796 lsmd 1945 pulseaudio
本文来自博客园,作者:chao_xiong,转载请注明原文链接:https://www.cnblogs.com/chao-xiong/p/19232704

浙公网安备 33010602011771号