Debian8系统如何用pgrep命令以名称为依据从运行进程队列中查找进程?
发布时间:2023-5-18 10:31:31 来源: 纵横云
Debian8系统如何用pgrep命令以名称为依据从运行进程队列中查找进程?本教程以debian8系统为例
本配置适用于debian8,9版本
1.介绍
pgrep命令以名称为依据从运行进程队列中查找进程,并显示查找到的进程id。每一个进程ID以一个十进制数表示,通过一个分割字符串和下一个ID分开,默认的分割字符串是一个新行。对于每个属性选项,用户可以在命令行上指定一个以逗号分割的可能值的集合。
2.参数
-o 仅显示找到的最小(起始)进程号;
-n 仅显示找到的最大(结束)进程号;
-l 显示进程名称;
-P 指定父进程号;
-g 指定进程组;
-t 指定开启进程的终端;
-u 指定进程的有效用户ID。
3.实例
显示最小进程号的一个sshd进程
pgrep -lo sshd

显示最大进程号的一个sshd进程
pgrep -ln sshd

列出所有sshd进程
pgrep -l sshd

列出所有sshd进程,并且不显示进程名称
pgrep sshd

本文来源:
https://www.zonghengcloud.com/article/10845.html
[复制链接]
链接已复制