A process can be sent a SIGTERM signal in three ways (the process ID is '1234' in this case):
kill 1234kill -TERM 1234kill -15 1234
The process can be sent a SIGKILL signal in two ways:
kill -KILL 1234kill -9 1234
Other useful signals include HUP, TRAP, INT and ALRM. A SIGINT signal can be generated very simply by pressing CTRL+C in most Unix shells. It is also common for CTRL+Z to be mapped to SIGTSTP (tty stop), and for CTRL+\ (backslash) to be mapped to SIGQUIT, which can force a program to do a core dump.
All signals except for SIGKILL and SIGSTOP can be "intercepted" by the process, meaning that a special function can be called when the program receives those signals. The two exceptions SIGKILL and SIGSTOP are only seen by the host system's kernel, providing reliable ways of controlling the execution of processes. SIGKILL kills the process, and SIGSTOP pauses it until a SIGCONT is received.On most shells, using the
'fg' command will resume execution of the process (that was suspended with Ctrl-Z), by sending it a CONT signal.Exceptions such as division by zero or a segmentation violation will generate signals (here, SIGFPE and SIGSEGV respectively, which both cause a core dump by default).
The kernel can generate a signal to notify the process of an event. For example, SIGPIPE will be generated when a process writes to a pipe which has been closed by the reader; by default, this causes the process to terminate, which is convenient when constructing shell pipelines.
For a complete list of supported signals, see signals.