Unix Signals
A signal is a message that can be sent to a running process.
Programs, users, or administrators can initiate signals.
For example, 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, type:
kill -SIGHUP 4140
Another common use of signals is to stop a running process. To stop the inetd process completely, use this command:
kill 4140
By default, the kill command sends the SIGTERM signal. If SIGTERM fails, 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 code pieces are called signal handlers.
A signal handler is unable to redefine two signals. SIGKILL always stops a process and SIGSTOP always moves a process from the foreground to the background. A signal handler cannot “catch” these two signals.
FreeBSD Signals
| Signal Name | Signal Number | Signal Description |
|---|---|---|
| SIGHUP | 1 | Terminal line hangup |
| SIGINT | 2 | Interrupt program |
| SIGQUIT | 3 | Quit program |
| SIGILL | 4 | Illegal instruction |
| SIGTRAP | 5 | Trace trap |
| SIGABRT | 6 | Abort |
| SIGEMT | 7 | Emulate instruction executed |
| SIGFPE | 8 | Floating-point exception |
| SIGKILL | 9 | Kill program |
| SIGBUS | 10 | Bus error |
| SIGSEGV | 11 | Segmentation violation |
| SIGSYS | 12 | Bad argument to system call |
| SIGPIPE | 13 | Write on a pipe with no one to read it |
| SIGALRM | 14 | Real-time timer expired |
| SIGTERM | 15 | Software termination signal |
| SIGURG | 16 | Urgent condition on I/O channel |
| SIGSTOP | 17 | Stop signal not from terminal |
| SIGTSTP | 18 | Stop signal from terminal |
| SIGCONT | 19 | A stopped process is being continued |
| SIGCHLD | 20 | Notification to parent on child stop or exit |
| SIGTTIN | 21 | Read on terminal by background process |
| SIGTTOU | 22 | Write to terminal by background process |
| SIGIO | 23 | I/O possible on a descriptor |
| SIGXCPU | 24 | CPU time limit exceeded |
| SIGXFSZ | 25 | File-size limit exceeded |
| SIGVTALRM | 26 | Virtual timer expired |
| SIGPROF | 27 | Profiling timer expired |
| SIGWINCH | 28 | Window size changed |
| SIGINFO | 29 | Information request |
| SIGUSR1 | 30 | User-defined signal 1 |
| SIGUSR2 | 31 | User-defined signal 2 |
| SIGTHR | 32 | Thread interrupt |
Solaris Signals
| Signal Name | Signal Number | Signal Description |
|---|---|---|
| SIGHUP | 1 | Hangs up |
| SIGINT | 2 | Interrupts |
| SIGQUIT | 3 | Quits |
| SIGILL | 4 | Illegal instruction |
| SIGTRAP | 5 | Trace trap |
| SIGABRT | 6 | Used by abort |
| SIGEMT | 7 | EMT instruction |
| SIGFPE | 8 | Floating-point exception |
| SIGKILL | 9 | Kill (cannot be caught or ignored) |
| SIGBUS | 10 | Bus error |
| SIGSEGV | 11 | Segmentation violation |
| SIGSYS | 12 | Bad argument to system call |
| SIGPIPE | 13 | Writes on a pipe with no one to read it |
| SIGALRM | 14 | Alarm clock |
| SIGTERM | 15 | Software termination |
| SIGUSR1 | 16 | User-defined signal 1 |
| SIGUSR2 | 17 | User-defined signal 2 |
| SIGCHLD | 18 | Child status change alias (POSIX) |
| SIGPWR | 19 | Power-fail restart |
| SIGWINCH | 20 | Window size change |
| SIGURG | 21 | Urgent socket condition |
| SIGPOLL /SIGIO | 22 | Pollable event occurred or Socket I/O possible |
| SIGSTOP | 23 | Stop (cannot be caught or ignored) |
| SIGTSTP | 24 | User stop requested from TTY |
| SIGCONT | 25 | Stopped process has been continued |
| SIGTTIN | 26 | Background TTY read attempted |
| SIGTTOU | 27 | Background TTY write attempted |
| SIGVTALRM | 28 | Virtual timer expired |
| SIGPROF | 29 | Profiling timer expired |
| SIGXCPU | 30 | Exceeded CPU limit |
| SIGXFSZ | 31 | Exceeded file size limit |
| SIGWAITING | 32 | Process’ LWPs are blocked |
| SIGLWP | 33 | Special signal used by thread library |
| SIGFREEZE | 34 | Special signal used by CPR |
| SIGTHAW | 35 | Special signal used by CPR |
| SIGCANCEL | 36 | Thread cancellation signal used by libthread |
| SIGLOST | 37 | Resource lost |
| SIGRTMIN | 38 | Highest priority real-time signal |
| SIGRTMAX | 45 | Lowest priority real-time signal |
Comments (1)
Leave a Reply
- How to Capture a Unix Terminal Session
One of the best methods to capture a Unix terminal session is to use the `script` command. In this example we start a script session, run a couple of commands, and then use the `exit` command to stop capturing the terminal session: $ script Script started, output file is typescript $ pwd /home/will $ ps [...]...
- Basic Unix Commands
The total number of Unix commands is immense. No normal user or system administrator would ever need to know them all. The Unix commands available to you will vary based upon several factors: The version of Unix you are using (FreeBSD, Linux, Solaris, AIX, HP-UX, OpenBSD, etc…) The Unix shell you are using (sh, csh, [...]...
- How to Use the Unix Find Command
The Unix find command, as the name implies, is a command that you can enter into the command line, or terminal, of a Unix operating system, allowing you to process any given set of files or directories. It is a highly useful command that you can take advantage of on Unix based operating system, making [...]...
- How to Use the Unix Top Command
Top is a small, but powerful program on both Unix and Linux systems. Its purpose is to allow users to monitor processes on their system. It has two main sections. The first displays general information such as the load averages, number of running and sleeping tasks, and overall CPU and memory usage. The second main [...]...
- Unix File Permissions
Unix file permissions are based upon an octal code. Unix file permissions are stored in a ten character array. The first character of the file permissions stores the file type. The standard file types are: Character Meaning - Plain file d Directory c Character device b Block device l Symbolic link s Socket = or [...]...





this was very helpful. finally, information when you ask for it with a simple search