How to find and kill Zombie Tasks in Linux server via SSH Commands?
When you log into your server, check all the processes by running following commands:
ps – ‘ps’ is a command which shows all proccesses on a server.
top – Its a best bash command to find top tasks on unix server system. ‘top’ will show you the top tasks which are using high server mem and CPU.
When you run top command in a linux server, the output will be somthing like this:
last pid: 85975; load averages: 0.00, 0.00, 0.00 up 514+01:52:49 17:19:08
32 processes: 1 running, 31 sleeping
CPU states: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle
Mem: 445M Active, 1596M Inact, 266M Wired, 29M Cache, 112M Buf, 160M Free
Swap: 4096M Total, 4K Used, 4096M Free
Please check out below image for the screenshot and click to enlarge it:
As showed in the screenshot, you can see all the users and the tasks running by them. They do have unique PID (Proccess ID) and other details such as memory, CPU% etc. To find the Zombie tasks, you just need to use the following command:
ps aux | grep Z
This will list all Zombie tasks and you can kill them if you wish with the following command:
sudo kill PID
Example: sudo kill 55565
Also, to get more details on these PID/Zombie, you can use lsof command.
Example: sudo lsof -p 55565
Explained: sudo for more privileges, lsof=list of -p=process 55565 is process ID.