pgrep 是通過程式的名字來查詢進程的工具,一般是用來判斷程式是否正在運行。在伺服器的配置和管理中,這個工具常被應用,簡單明瞭;
用法:
#ps 參數選項 程式名
常用參數
-l 列出程式名和進程ID;
-o 進程起始的ID;
-n 進程終止的ID;
舉例:
[[email protected] ~]# pgrep -lo httpd4557 httpd
[[email protected] ~]# pgrep -ln httpd4566 httpd
[[email protected] ~]# pgrep -l httpd4557 httpd
4560 httpd
4561 httpd
4562 httpd
4563 httpd
4564 httpd
4565 httpd
4566 httpd
[[email protected] ~]# pgrep httpd4557
4560
4561
4562
4563
4564
4565
4566
pgrep -fl rtmp
Hits: 273