Process theory
- process exit code is passed to its parent process
- when parent process does not reap exit code, process becomes zombie
- the only possibility to kill defunct process is killing the parent
Kill defunct processes by killing their parents
Defunct processes (zombies) usually have to be killed by killing their parent processes. this command retrieves such zombies and their immediate parents and kills all of the matching processes (source).
ps afx | grep defunct -B 1 | grep -Eo "[0-9]{3,}" | xargs kill -9
Listing files opened by process
- ls -l /proc/<pid>/fd
- lsof -p <pid>