Questions about signals, a kind of interprocess communication.
Signals are a kind of interprocess communication on Unix-like operating systems, including Ubuntu.
Some signals can be handled or ignored by the program that receives them, if it is designed to do so. Others invariably terminate the program.
The kill
, killall
, and pkill
commands send signals. By default they send SIGTERM, which allows the program to clean up. Commands like kill -KILL
, or the equivalent kill -9
, send SIGKILL, which cannot be ignored.
When programs crash, they are terminated by a signal, usually SIGSEGV ("Segmentation fault") or SIGABRT. Pressing Ctrl+C in a terminal sends SIGINT. This terminates most noninteractive programs (and programs whose interaction is not in a terminal, such as servers and graphical applications). Most interactive programs, especially shells, cancel the current operation and return the user to the program's primary (i.e. outermost) prompt, when SIGINT is received.
The signals SIGUSR1 and SIGUSR2 are traditionally used to provide limited interactivity with otherwise noninteractive programs. Using kill -USR1
on a running dd
process to query its status was once very common, since dd
prints out this information when it receives SIGUSR1. But a status=progress
argument passed to dd
has risen in popularity since becoming available.
There are numerous other signals not summarized above.
Most Bourne-style shells, including bash
, provide a feature to handle signals in a shell script (or interactive shell session). The trap
command registers signal handlers.
The signal tag may be used for questions about how to use, send, and handle signals; problems that appear to involve signals in an important way; and situations where signals are used.
The term "signal" is also used with various other meanings. For example, there is a secure messaging application called Signal. There is also the concept of "signal strength" in wireless networking and software-defined radio. Exactly which other tags should be used instead for these things--as well as when signal, kill, or both should be used--does not appear fully established.