$ ps aux | grep -i ssh
USER 4364 0.0 0.0 9004 1032 ? Ss 12:20 0:00 ssh -v -fND localhost:4000 USERNAME@SERVER-IP-ADDRESS
$ pgrep localhost:4000
Run Code Online (Sandbox Code Playgroud)
为什么这不起作用?
cam*_*amh 25
默认情况下,pgrep(1)
只会匹配进程名称。如果要匹配完整的命令行,请使用以下-f
选项:
$ pgrep -f localhost:4000
Run Code Online (Sandbox Code Playgroud)