我在我的 Ubuntu 服务器上运行了一些我自己创建的进程,为了杀死它们我运行了:
sudo fuser -n tcp PORT
kill -9 PID-DISPLAYED
有什么方法可以使用 shell 脚本从端口获取 PID,然后通过运行 shell 脚本将其杀死。
谢谢。
最佳答案
fuser 可以杀死它:
-k, --kill
Kill processes accessing the file. Unless changed
with -SIGNAL, SIGKILL is sent. An fuser process
never kills itself, but may kill other fuser processes.
The effective user ID of the process executing fuser is
set to its real user ID before attempting to kill.
关于linux - 用于杀死 PID 的 Shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17190352/