Being able to recognize when and how to terminate running processes is an essential skill for system administrators. Sometimes a process becomes stuck and only requires a gentle nudge to either restart or stop. Sometimes a process takes up all the system resources. In both situations, you require a command that will let you manage a process.

The Linux operating system has a number of commands that can be used to end errant processes (rogue processes), such as pkill command, kill command, killall command and so on. This article discusses the kill command, which is the most commonly used.

What are Linux signals?

Signals are used by Linux processes to communicate with one another. A process signal is a preset message that processes understand  and can either ignore or respond to. Developers define how a process handles signals.

Below are some of the signals that processes can receive and respond to:

<table with signals to be send via email>

They are several Linux commands you can use to send process signals to processes running such as the ones I mention above.

kill command in Linux

Most  shells, including Bash and zsh, come with a built-in  kill command. The  /bin/kill or /usr/bin/kill executable and the shells built-in kill have slightly different  behavior. To see all the locations on your system that contain kill, use the type command and the -a option:

$ type -a kill

You can see from the result above that when you type kill on your command line, the shell builtin is used rather than the executable binaries. To use the excecutable binary use the  complete path to the binary (for example, /bin/kill or /usr/bin/kill).

We will discuss the bash built in command in this article, so if you are using another shell, you must switch to bash to get similar results.

The kill command has the following syntax:

kill [options] <pid> [...]

The kill command lets you send signals to processes depending on their PIDs . All of the PIDs given on the command line receive a TERM signal by default when the kill command is used.

The following are the most commonly used signals: