Linux signals: Difference between revisions

From Leo's Notes
This page was last edited on 24 September 2022, at 09:03.
mNo edit summary
No edit summary
 
Line 1: Line 1:
Signals are messages that are sent to a program.
Here are some Linux signals in brief detail. You may quickly list available signals by running <code>kill -l</code>.
{| class="wikitable"
{| class="wikitable"
!Signal Name
!Signal Name
Line 10: Line 13:
|SIGINT
|SIGINT
|2
|2
|Signals when the Linux user presses ‘CONTROL-C’
|Signals when the Linux user presses <code>Ctrl-c</code>
|-
|-
|SIGQUIT
|SIGQUIT
|3
|3
|Signals when the Linux user presses ‘CONTROL-D’
|Signals when the Linux user presses <code>Ctrl-d</code>
|-
|-
|SIGILL        
|SIGILL        
Line 22: Line 25:
|SIGTRAP
|SIGTRAP
|5
|5
|
|Trap or breakpoint signal
|-
|-
|SIGABRT
|SIGABRT
|6
|6
|
|Abort signal
|-
|-
|SIGBUS        
|SIGBUS        
|7
|7
|
|Illegal access to an undefined portion of memory
|-
|-
|SIGFPE
|SIGFPE
Line 42: Line 45:
|SIGUSR1
|SIGUSR1
|10
|10
|
|User defined signal. Typically programs will print its status (eg. <code>dd</code>)
|-
|-
|SIGSEGV
|SIGSEGV
Line 50: Line 53:
|SIGUSR2      
|SIGUSR2      
|12
|12
|
|User defined signal.
|-
|-
|SIGPIPE      
|SIGPIPE      
|13
|13
|
|Write on a pipe with no one to read it
|-
|-
|SIGALRM
|SIGALRM
Line 66: Line 69:
|SIGSTKFLT    
|SIGSTKFLT    
|16
|16
|
|Stack fault
|-
|-
|SIGSTOP
|SIGSTOP
Line 74: Line 77:
|SIGCONT      
|SIGCONT      
|18
|18
|
|Resume program execution from a <code>SIGSTOP</code> or <code>SIGTSTP</code>.
|-
|-
|SIGSTOP      
|SIGSTOP      
|19
|19
|
|Stop signal sent with <code>kill -STOP</code> to suspend a program. Cannot be ignored by the program.
|-
|-
|SIGTSTP
|SIGTSTP
|20
|20
|
|Signals when the Linux user presses <code>Ctrl-z</code>. May be ignored by the program.
|-
|-
|SIGTTIN      
|SIGTTIN      
|21
|21
|
|Delivered to a background process if it tries to read from the terminal.
|-
|-
|SIGTTOU      
|SIGTTOU      
|22
|22
|
|Delivered to a background process if it tries to write to the terminal.
|-
|-
|SIGURG
|SIGURG
|23
|23
|
|Urgent data received on a socket.
|-
|-
|SIGXCPU      
|SIGXCPU      
|24
|24
|
|Process exceeds CPU limit or time. Save your work before you get killed.
|-
|-
|SIGXFSZ
|SIGXFSZ
|25
|25
|
|File written by this process exceeded some size limit.
|-
|-
|SIGVTALRM    
|SIGVTALRM    
|26
|26
|
|CPU time elapsed
|-
|-
|SIGPROF
|SIGPROF
Line 114: Line 117:
|SIGWINCH    
|SIGWINCH    
|28
|28
|
|Window size changed.
|-
|-
|SIGIO        
|SIGIO        
|29
|29
|
|Signal input/output trap. Program should abort unless handled properly.
|-
|-
|SIGPWR
|SIGPWR
|30
|30
|
|Power failure?
|-
|-
|SIGSYS
|SIGSYS
|31
|31
|
|Bad system call
|}
|}
== See also ==
* Wikipedia's article outlines all the signals and their default actions: https://en.wikipedia.org/wiki/Signal_(IPC)

Latest revision as of 09:03, 24 September 2022

Signals are messages that are sent to a program.

Here are some Linux signals in brief detail. You may quickly list available signals by running kill -l.

Signal Name Signal Number Description
SIGHUP 1 Hangs up signals when controlling the terminal or at the end of the controlling processes.
SIGINT 2 Signals when the Linux user presses Ctrl-c
SIGQUIT 3 Signals when the Linux user presses Ctrl-d
SIGILL       4 Illegal instruction trap
SIGTRAP 5 Trap or breakpoint signal
SIGABRT 6 Abort signal
SIGBUS       7 Illegal access to an undefined portion of memory
SIGFPE 8 Signals when any unexpected mathematical operation is performed.
SIGKILL 9 When any of the process issues this signal, it will quit immediately.
SIGUSR1 10 User defined signal. Typically programs will print its status (eg. dd)
SIGSEGV 11 Segmentation fault
SIGUSR2     12 User defined signal.
SIGPIPE     13 Write on a pipe with no one to read it
SIGALRM 14 Signals for alarm clock
SIGTERM 15 Signals to terminate the process or the software.
SIGSTKFLT   16 Stack fault
SIGSTOP 17 Signals to stop the process in Linux.
SIGCONT     18 Resume program execution from a SIGSTOP or SIGTSTP.
SIGSTOP     19 Stop signal sent with kill -STOP to suspend a program. Cannot be ignored by the program.
SIGTSTP 20 Signals when the Linux user presses Ctrl-z. May be ignored by the program.
SIGTTIN     21 Delivered to a background process if it tries to read from the terminal.
SIGTTOU     22 Delivered to a background process if it tries to write to the terminal.
SIGURG 23 Urgent data received on a socket.
SIGXCPU     24 Process exceeds CPU limit or time. Save your work before you get killed.
SIGXFSZ 25 File written by this process exceeded some size limit.
SIGVTALRM   26 CPU time elapsed
SIGPROF 27
SIGWINCH     28 Window size changed.
SIGIO       29 Signal input/output trap. Program should abort unless handled properly.
SIGPWR 30 Power failure?
SIGSYS 31 Bad system call

See also