How to kill defunct processes.

在遇到defunct processes时,可以使用kill -9命令。

首先使用ps -xal  | grep {命令的名字} 查找到具体的命令,使用kill -9 pid,

如果仍旧没有反应可以杀掉parent process 进而杀掉该process。

但在使用kill -9 {parent process pid} 时需要注意,最好先确认kill -9 {sun process pid} 使用后无反应再使用该命令。

而且可以先使用kill -1 {parent process pid}, kill {parent process pid} 和kill -2 {parent process pid} 尝试,否则由于该命令的巨大杀伤力可能造成其它未知问题。

 

今天还遇到一个问题,运行shell命令时卡死,可以使用jobs -p查看后台运行的进程的pid,进而杀死进程。