Kill a process in Linux

The kill command is used to terminate (kill) a process in Linux. If a program becomes totally unresponsive, you might be forced to terminate it using this command. The kill command sends signals to running processes (identified by their PIDs) in order to request the termination of the process. Besides telling a process to end, signals can tell a process to reread configuration files, pause, continue if stopped, etc. Signals are represented using different numbers. If you don’t specify the signal, the default value is 15, which causes the process to exit but allow it to close open files.

Here is a list of the signals you’re most likely to use and their description:

linux kill signals

For example, lets say that we have a program called dd that is using most of the CPU time and we can’t stop it using traditional methods. To kill it with the kill command, first we need to determine the PID of the process. That can be done using the top command:

linux top pid

The top command displays the PID of the process (13203). To kill the process, we use the kill command. We will use a SIGKILL signal which causes the process to exit without performing routine shutdown tasks:

linux kill 9

Geek University 2022