u1w2

 

在已知进程名(name)的前提下,交互式 Shell 获取进程 pid 有很多种方法,典型的通过 grep 获取 pid 的方法为(这里添加 -v grep是为了避免匹配到 grep 进程):

ps -ef | grep "name" | grep -v grep | awk \'{print $2}\'

  

 


出处:

Bash Shell 获取进程 PID - Let There Be Light (weyo.me)

 

 
 

分类:

技术点:

相关文章: