What is a kill command?
Linux is an advanced and great operating system; however, it's not perfect. A few applications might start behaving carelessly and become insensitive or begin consuming several system resources.
Insensitive applications can't be rebooted because the actual application process never goes down completely. A single solution is for either restarting the system or killing the process of the application.
There are various utilities that permit us for terminating errant processes along with the kill command. This command is most widely used in Linux.
In Linux, the kill command (located inside the /bin/kill) can be defined as a built-in command.
It is used for manually terminating the processes. The behaviour of the kill command is slightly different among the shells and the /bin/kill standalone executable.
We can apply the type command for displaying every location on our system that is containing kill:
The kill command transfers a signal towards a process in which further terminates the process. When the user does not describe any signal that is to be transferred with the kill command then the TERM signal (default) is transferred that will terminate the process. If the signal is not described, then it will default to -15 (-TERM).
The most widely applied signals are as follows:
We can use the kill command along with the -l option for getting the list of every available signal:
These signals could be described in three different ways. These ways are listed below:
The below commands are similar to each other:
The PIDs given to the kill command could be anyone from the below:
Regular users are able to transfer signals to their processes. However, it does not include those users who are related to any other user. On the other hand, the root user is able to transfer the signal to the processes of the other user.
ps aux: This command is used for displaying every running process along with their PIDs and other details. In case, we don't know the process ID we can use this command.
Options of the kill command
1. kill -l: This option is used for displaying every existed signal, we can apply the following command option:
2. kill pid: This option is used for showing how to apply the PID along with the kill command.
3. kill -L: The kill -L command can be used for listing the existed signals in a format of the table.
4. Translate Signal Number: We can easily translate any signal number into a signal name by using the following command: