To list process zombies, try this command:
ps j | awk '$7 ~ "Z"'
You may need to change $7
depending on your operating system.
This also will return the list of their parent process ids (PPID
).
To try to kill the zombies (after testing the above command), try:
kill -9 $(ps j | awk 'NR>1 && $7 ~ "Z" {print $2}')
To identify their parents, try with pstree
, like:
$ ps j | awk 'NR>1 && $7 ~ "T" {print $2}' | xargs -L1 pstree -sgsystemd(1)───sshd(1036)───sshd(2325)───sshd(2325)───bash(2383)───zombie(2430)systemd(1)───sshd(1036)───sshd(2325)───sshd(2325)───bash(2383)───zombie(2431)systemd(1)───sshd(1036)───sshd(2325)───sshd(2325)───bash(2383)───zombie(2432)