glo*_*loo 2 linux terminal kill-process
如何终止从以下命令返回的所有进程?
lsof -i
Run Code Online (Sandbox Code Playgroud)
我已尝试以下方法但无济于事:
lsof -i | awk '{print $2}' | kill
Run Code Online (Sandbox Code Playgroud)
kill将 PID 作为其参数,而当您通过管道传递它时,它会转到kill.
将它们作为参数传递:
kill $(lsof -i | awk '{print $2}')
Run Code Online (Sandbox Code Playgroud)