Updated June 20, 2023
Definition of Linux Kill Signals
The process of transmitting a message from one process to another process is commonly referred to as signaling. They might ignore the signals or leave to perform the default action. The kill command in Linux will allow users to send a signal to the process.
Syntax:
Kill signal command in Linux does not only use to stop processes running in the Linux system but is also used to terminate the software from all illegal programs. Thus, few of the kill command signals in Linux are a part of security parameters.
The Basic syntax of the Kill Signal command in Linux is :
kill -signal -pid
Here signal can be either the signal name or the number of the signal used to send to the process, and pid is the process_ID.
kill -l
Here -l will list out all the signals that are supported in Linux. This command will list the signal names. The output of the command will display as below:
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3
38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8
43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAX
How to Kill Signals in Linux?
Here are the common signals that we generally use in Linux.
Signal Name | Signal Number | Description |
SIGINT | 2 | Signals when the Linux user presses ‘CONTROL-C’ |
SIGHUP | 1 | Hangs up signals when controlling the terminal or at the end of the controlling processes. |
SIGQUIT | 3 | Signals when the Linux user presses ‘CONTROL-D’ |
SIGFPE | 8 | Signals when any unexpected mathematical operation is performed. |
SIGKILL | 9 | When any of the process issues this signal, it will quit immediately. |
SIGALRM | 14 | Signals for an alarm clock |
SIGTERM | 15 | Signals to terminate the process or the software. |
SIGSTOP | 17,19,23 | Signals to stop the process in Linux. |
Examples
There are many ways to send signals to a program in Linux.
Option SIGINT
The most common way to kill a process in Linux is by using ‘CONTROL-C’; when we press ‘CONTROL-C’ SIGINT signal is sent to the program, and by default, the program terminates.
Option SIGKILL
This Command kills a process by taking the signal name, and the user in Linux gives PID.
Syntax:
kill -9 5653
Command:
kill -SIGKILL 5653
Example: Here, we will kill the process id 5653 by using -SIGKILL command.
Option killall
This command kills the process with its name. We should be particularly killing the process by using its name. For example, if any process is running for a long time and the Linux user has no idea about the process id, then we can kill the process by its process name.
Syntax:
killall -SIGKILL pname
Command:
killall -SIGKILL tez
Example: Here particular process named ‘tez’ is killed in Linux.
Option pkill
The command ‘pkill’ is more likely to killall commands except that it will allow using partial process_names. For example, if there are many processes whose names are partially common, we can kill all of them using pkill command. We can also kill users with this command.
Syntax:
pkill -9 process_name
pkill -9 -u username
Command:
pkill -9 tez
pkill -9 -u root
Example: Here, all the processes are killed whose names are partially common to process ‘tez.’
List of Linux Kill Signals
Below is the list of Signals and their descriptions:
- SIGTRAP – The main purpose of SIGTRAP command signal is to debug a process.
- SIGABRT – This SIGABRT kill signal is used for aborting the processing signal. Basically, a process is initiated by SIGABRT to kill the signal on its own.
- SIGBUS – Whenever a program sends the SIGBUS signal, it happens to be caused by a bus error. Generally, the bus errors are because of a program that tries to utilize duplicate physical addresses or because the program may have its memory settings set incorrectly.
- SIGCHLD – Whenever a parent program does not find its child process, then the parent program sends the SIGCHLD signal.
- SIGPROF – Whenever any process is using CPU Time, then the SIGPROF signal is sent by the system when the program is elapsing.
- SIGPOLL – Whenever a program is causing any non-concurrent I/O actions, that program will send the SIGPOLL signal.
Conclusion
The kill signal command in Linux stops processes running in the Linux system and terminates software from all illegal programs. Thus, few of the kill command signals in Linux are a part of security parameters. In the above article, we have shown how to use the kill command to send signals to the processes in Linux Server.
Recommended Articles
We hope that this EDUCBA information on “Linux Kill Signals” was beneficial to you. You can view EDUCBA’s recommended articles for more information.