Linux - Kill zombie process, Attempt to kill a zombie process

Kill zombie process

What is difference between defunct process and zombie Process?
A "defunct" processes is also known as a "zombie" processes. A zombie process is known as dead process.

How to find a defunct process?
 # ps -ef | grep defunct
Grep defunct value in ps -ef output
Output:
Guru    2544  2482  0 07:40 ?        00:00:14 [chrome] <defunct>
Guru    2785  2482  0 07:57 ?        00:00:00 [chrome] <defunct>
root      3180  2936  0 09:41 pts/0    00:00:00 grep --color=auto defunct

 # ps aux | awk '{ print $8 " " $2 }' | grep -w Z
Output:
 Z 2544
 Z 2785

How can i kill a defunct process?
 # kill -9 2544

If you still have an issue with killing Zombie Process
 # kill -9 parent-id-of-defunct-pid
Try to kill the PPID of the zombie process

How to find the PPID "parent ID of a process"?
 # ps -axjf

OUTPUT:

PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
1 2482 1738 1738 ? -1 Sl 500 2:19 /opt/google/chrome/chrome
2482 2487 1738 1738 ? -1 Sl 500 0:01 \_ /opt/google/chrome/chrome
2482 2544 1738 1738 ? -1 Z 500 0:14 \_ [chrome]
2482 2785 1738 1738 ? -1 Z 500 0:00 \_ [chrome]
2482 2901 1738 1738 ? -1 Sl 500 2:09 \_ /opt/google/chrome/chrome --type=plugin

The parent ID of zombie process "2544" is "2482", Now If we make an attempt to kill the zombie process, then the zombie process will be killed.
 # kill -9 2482
Now we killed the parent process ID PPID. So that now the zombie process is killed.

What is orphan process?
An orphan process is said to be a process which runs though parent process is terminated, these process do not know what to do and when to terminate.

What is difference between orphan and defunct processes?
A defunct process is a dead process where there is no execution happening where as orphan process is a live process which is still in execution state but don't have parent process.

The topic on Linux - Kill zombie process is posted by - Guru

Hope you have enjoyed, Linux - Kill zombie processThanks for your time

Tech Bluff