Kill Command in Linux with Examples

Posted in

Kill Command in Linux with Examples

Sangeeta Gulia
Last updated on June 20, 2024

    Kill command is a popular and helpful command used in UNIX-like and Linux operating systems. It is used to terminate a running process or application using the command line interface. In this article, we will be going to discuss concepts and examples related to the kill command.

    What is the Kill command?

    kill is a command that accomplishes exactly what it says on the label. Processes and applications are terminated or killed by it. There are more complexities to it, but that's the gist of it. When we use the kill command on a process, a signal is sent, and the process is terminated. The user must include a signal with the kill command; if the user does not provide a signal with the kill command, the process will be terminated by the TERM signal, which is a default signal.

    Conventions of process PIDs

    The signal is sent to the process with an ID as the PID specified if the PID is greater than 0.

    The signal gets transferred to processes in the current process group if PID equals to zero.

    The signal is transferred with the same UID as the user invoking the command to all the processes if PID equals to -1.

    The signal is transferred with GID equal to the absolute value of the PID to all processes in the process group if PID is less than -1.

    1. kill -l

    This command can be used to print all of the signals which are available to use. Signals are specified using:

    Signals can be specified in three ways:

    • Number
    • SIG prefix (e.g. -SIGkill)
    • Without SIG prefix (e.g. -kill)

    2. kill pid

    This shows how PID is used with kill command.

    3. kill -s

    This is used to figure out how signals are sent to the processes. The syntax of the command is

    kill {-signal | -s signal} pid

    4. kill -L

    This command is used to display a tabular format of available signals. The syntax is

    kill {-l | —list[=signal] | -L | —table}.


    In this article, we went through various options and terms related to the kill command. The kill command sends the signal to the kernel to terminate the running process. We can use many options like -L, pid, -s, -l with the kill command to terminate and get process terminating related information.

    People are also reading:

    Leave a Comment on this Post