There are multiple commands supported in UNIX/Linux to kill a process. The most-used command is “kill” command which expects PID of the process which can be retrieved from the output of “ps” command.

To kill a process named httpd, first search for the process in the output of “ps” command and use the PID to kill it.

[neo@techpulp ~]# ps -e | grep kcalc
3482 ?        00:00:00 kcalc
[neo@techpulp ~]# kill 3482
[neo@techpulp ~]# ps -e | grep kcalc
[neo@techpulp ~]#

If the process is not killed using the above command and if you want to terminate the process for sure, you can use “kill -9″ which always terminates the process. However it is advised to be used with a process which is not responding and also only if normal kill doesn’t work.

If you want to kill multiple processes at once you can just specify all PIDs to the “kill” command.

[neo@techpulp ~]# kill 3482 3486 3490

If you want to kill all the processes of same name, you can use “killall” command similar to “kill” command. But “killall” command expects the process name instead of PID which is more convenient.

[root@techpulp ~]# killall httpd

Similarly if the processes do not terminate with normal “killall” command, you can use “killall -9″ so that the processes are terminated for sure.

[root@techpulp ~]# killall -9 httpd

There is another command “pkill” which also does same like “killall” command.

[root@techpulp ~]# pkill -9 httpd