简体   繁体   中英

Linux killing process with kill -9 PID

尝试使用ps和ps -ef之类的示例,在Linux中使用kill-9 PID杀死进程后,如何验证天气是否杀死了该进程?

Just run ps aux stat,pid again, and you will see the process with this pid is either a zombie ('Z' in the first column) or dead.

Edit: Thanks, Mark B, for pointing me about zombies.

Ater the kill, check the PID of the process:

$ pidof PROCESS

You should see no output if the process is gone.

Another similar way:

$ ps aux | grep PROCESS

Notes:

  • You can kill your own process, but only root user can kill system process or another user process.
  • After you KILL the process you can get a zombie, you can still see it in the process list but with process STATE Z (wich means Zombie). Zombies cant be killed, they are already dead, so to "kill" zombies you need to kill the zombie's parents. That said, in general you don't need to get rid of zombie processes unless you have a large amount of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM