What a command's exit status means, and the signals you send with kill.
| Code | Meaning | Notes |
|---|---|---|
| 0 | Success | Command completed without error |
| 1 | General error | Catch-all for a failure |
| 2 | Misuse of a builtin | Wrong usage or syntax |
| 126 | Not executable | Found but lacks execute permission |
| 127 | Command not found | Typo or not in PATH |
| 128 | Invalid exit argument | exit called with a bad value |
| 130 | Ended by Ctrl-C | Terminated by SIGINT (128 + 2) |
| 137 | Killed | SIGKILL (128 + 9) — often out of memory |
| 143 | Terminated | SIGTERM (128 + 15) |
| 255 | Out of range | Exit code above 255 wraps around |
| Signal | No. | Meaning |
|---|---|---|
| SIGHUP | 1 | Hang-up; often used to reload config |
| SIGINT | 2 | Interrupt from the keyboard (Ctrl-C) |
| SIGQUIT | 3 | Quit and dump core |
| SIGKILL | 9 | Force kill — cannot be caught or ignored |
| SIGSEGV | 11 | Segmentation fault (bad memory access) |
| SIGTERM | 15 | Polite request to terminate (default kill) |
| SIGSTOP | — | Pause a process — cannot be caught |
| SIGCONT | — | Resume a paused process |
| SIGUSR1 | — | User-defined signal 1 |
Every command returns an exit status when it finishes: 0 means success and anything non-zero means some kind of failure, which is what lets shell scripts branch on whether a step worked. You can read the last one with echo $?. A handful are conventional: 127 means the command wasn't found (usually a typo or a PATH problem), 126 means it was found but isn't executable, and 1 and 2 are generic errors. The codes above 128 are special — they mean the process was killed by a signal, and the signal number is the code minus 128 (so 130 is Ctrl-C, signal 2). Signals are how you tell a running process to stop: SIGTERM (15) asks politely and lets it clean up, while SIGKILL (9) is the unstoppable force-kill you reach for when nothing else works. For the commands that send them, see the Linux commands.