hotkeys = shortcuts.


<span class="pun">/*</span> <span class="typ">Signals</span><span class="pun">.</span>  <span class="pun">*/</span>
<span class="com">#define SIGHUP      1   /* Hangup (POSIX).  */</span>
<span class="com">#define SIGINT      2   /* Interrupt (ANSI).  */</span>
<span class="com">#define SIGQUIT     3   /* Quit (POSIX).  */</span>
<span class="com">#define SIGILL      4   /* Illegal instruction (ANSI).  */</span>
<span class="com">#define SIGTRAP     5   /* Trace trap (POSIX).  */</span>
<span class="com">#define SIGABRT     6   /* Abort (ANSI).  */</span>
<span class="com">#define SIGIOT      6   /* IOT trap (4.2 BSD).  */</span>
<span class="com">#define SIGBUS      7   /* BUS error (4.2 BSD).  */</span>
<span class="com">#define SIGFPE      8   /* Floating-point exception (ANSI).  */</span>
<span class="com">#define SIGKILL     9   /* Kill, unblockable (POSIX).  */</span>
<span class="com">#define SIGUSR1     10  /* User-defined signal 1 (POSIX).  */</span>
<span class="com">#define SIGSEGV     11  /* Segmentation violation (ANSI).  */</span>
<span class="com">#define SIGUSR2     12  /* User-defined signal 2 (POSIX).  */</span>
<span class="com">#define SIGPIPE     13  /* Broken pipe (POSIX).  */</span>
<span class="com">#define SIGALRM     14  /* Alarm clock (POSIX).  */</span>
<span class="com">#define SIGTERM     15  /* Termination (ANSI).  */</span>
<span class="com">#define SIGSTKFLT   16  /* Stack fault.  */</span>
<span class="com">#define SIGCLD      SIGCHLD /* Same as SIGCHLD (System V).  */</span>
<span class="com">#define SIGCHLD     17  /* Child status has changed (POSIX).  */</span>
<span class="com">#define SIGCONT     18  /* Continue (POSIX).  */</span>
<span class="com">#define SIGSTOP     19  /* Stop, unblockable (POSIX).  */</span>
<span class="com">#define SIGTSTP     20  /* Keyboard stop (POSIX).  */</span>
<span class="com">#define SIGTTIN     21  /* Background read from tty (POSIX).  */</span>
<span class="com">#define SIGTTOU     22  /* Background write to tty (POSIX).  */</span>
<span class="com">#define SIGURG      23  /* Urgent condition on socket (4.2 BSD).  */</span>
<span class="com">#define SIGXCPU     24  /* CPU limit exceeded (4.2 BSD).  */</span>
<span class="com">#define SIGXFSZ     25  /* File size limit exceeded (4.2 BSD).  */</span>
<span class="com">#define SIGVTALRM   26  /* Virtual alarm clock (4.2 BSD).  */</span>
<span class="com">#define SIGPROF     27  /* Profiling alarm clock (4.2 BSD).  */</span>
<span class="com">#define SIGWINCH    28  /* Window size change (4.3 BSD, Sun).  */</span>
<span class="com">#define SIGPOLL     SIGIO   /* Pollable event occurred (System V).  */</span>
<span class="com">#define SIGIO       29  /* I/O now possible (4.2 BSD).  */</span>
<span class="com">#define SIGPWR      30  /* Power failure restart (System V).  */</span>
<span class="com">#define SIGSYS      31  /* Bad system call.  */</span>

Ctrl+Z = SIGSTOP

Ctrl+D = End-Of-Line, EOL (not a signal i guess)

Question: What signal is send by Ctrl+C? (scroll down for answer)

 

Answer:

SIGINT

The

SIGINT

(“program interrupt”) signal is sent when the user types the INTR character (normally C-c). See Special Characters, for information about terminal driver support for C-c

SIGTERM != SIGINT?

SIGKILL: Terminates a process immediately. This signal cannot be handled (caught), ignored or blocked. (The „kill -9“ command in linux generates the same signal).

SIGTERM: Terminates a process immediately. However, this signal can be handled, ignored or caught in code.

Unlike

SIGKILL

, this signal can be blocked, handled, and ignored. It is the normal way to politely ask a program to terminate.

The shell command

kill

generates

SIGTERM

by default.

If the signal is not caught by a process, the process is killed. Also, this is used for graceful termination of a process. (The „kill“ command in linux if specified without any signal number like -9, will send SIGTERM)

SIGINT: Interrupts a process. (The default action is to terminate gracefully).

This too, like, SIGTERM can be handled, ignored or caught.

The difference between SIGINT and SIGTERM is that SIGINT can be sent via keyboard-hotkey Strg+C from a terminal as input characters – SIGTERM can probably only be send between programs. (no direct interaction keyboard->program, but process->process)

This is the signal generated when a user presses Ctrl+C. (Sidenote: Ctrl+C denotes EOT(End of Transmission) for (say) a network stream)

SIGQUIT: Terminates a process. This is different from both SIGKILL and SIGTERM in the sense that it generates a core dump of the process and also cleans up resources held up by a process. Like SIGINT, this can also be sent from the terminal as input characters. It can be handled, ignored or caught in code. This is the signal generated when a user presses Ctrl+\.

SIGSTP: Suspends a process. This too, can be handled, ignored or blocked. Since it does not terminate the process, the process can be resumed by sending a SIGCONT signal. This signal can be generated by pressing Ctrl+Z. (Sidenote: Ctrl+Z stands for substitute character which indicates End-of-File in DOS)

SIGHUP: (From Wikipedia): Hangs up a process when the controlling terminal is disconnected. This especially relates to modem/dial in connections. A process has to explicitly handle this signal for it to work. A good use is to „poke“ a process and letting the process (as defined by the programmer) decide what to do with the signal is described here. Hence, SIGHUP can be handled, ignored or caught. This is the signal generated when a user presses Ctrl+D.

credits: https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html

http://programmergamer.blogspot.de/2013/05/clarification-on-sigint-sigterm-sigkill.html

list of all terminal control character assignments:

uname -a; # tested on
Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.43-2 (2017-04-30) i686 GNU/Linux

stty -a
speed 38400 baud; rows 57; columns 164; line = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
admin