26.2. Signals

A signal is a type of message sent from the system to inform a command or script that an event has occurred somewhere. The events are usually to do with memory error, access problems or some user trying to stop your process. The signals are actually numbers. Below is a table listing the most used signals and their meaning.

Signal no. Signal name Meaning
1 SIGHUP Hangup or parent process killed
2 SIGINT Interrupt from keyboard, usually <CTRL-C>
3 SIGQUIT Quit from the keyboard
9 SIGKILL Definite kill
11 SIGSEGV Segmentation (memory) violation
15 SIGTERM Software termination (default kill)

There is a signal 0, which we have already met when we created a .logout file earlier in the book. This signal is the ‘exit from shell’ signal. ...

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.