A signal is a message which can be sent to a running process.
Signals can be initiated by programs, users, or administrators.
For example, to the proper method of telling the Internet Daemon (inetd) to re-read its configuration file is to send it a SIGHUP signal.
For example, if the current process ID (PID) of inetd is 4140, we would type:
kill -SIGHUP 4140
Another common use of signals is to stop a running process. To stop the inetd process completely, we would use this command:
kill 4140
By default, the kill command sends the SIGTERM signal. If SIGTERM fails, we can escalate to using the SIGKILL signal to stop the process:
kill -9 4140
Because SIGKILL cannot be handled, stopping a process with SIGKILL is generally considered a bad idea. Using SIGKILL prevents a process from cleaning up after itself and exiting gracefully.
Handling Signals
Each Unix signal has a default set of effects on a Unix program. Programmers can code their applications to respond in customized ways to most signals. These custom pieces of code are called signal handlers.
Two signals are unable to be redefined by a signal handler. SIGKILL always stops a process and SIGSTOP always moves a process from the foreground to the background. These two signals cannot be "caught" by a signal handler.