Exit Codes and Signals
What a process's exit status means: general errors, command not found, sysexits codes, and 128 plus a signal number such as 137 (SIGKILL, OOM) and 143 (SIGTERM).
Free · No sign-up · Your inputs stay in your browser
Reference
Exit codes and signals
| Code | Meaning | Notes |
|---|---|---|
| 0 | Success | |
| 1 | General error | Catch-all for any failure; most programs use only 0 and 1. |
| 2 | Misuse of a shell builtin / bad arguments | Many CLIs return 2 for invalid usage. |
| 64 | EX_USAGE | Command used incorrectly (sysexits.h). |
| 65 | EX_DATAERR | Input data was incorrect. |
| 66 | EX_NOINPUT | An input file did not exist or was unreadable. |
| 69 | EX_UNAVAILABLE | A service is unavailable. |
| 70 | EX_SOFTWARE | Internal software error. |
| 71 | EX_OSERR | Operating system error, e.g. cannot fork. |
| 73 | EX_CANTCREAT | Cannot create an output file. |
| 74 | EX_IOERR | Input/output error. |
| 75 | EX_TEMPFAIL | Temporary failure; retrying may work. Mail servers queue and retry on it. |
| 77 | EX_NOPERM | Permission denied. |
| 78 | EX_CONFIG | Configuration error. |
| 125 | docker run failed | The Docker daemon could not run the container (bad flag, image problem). |
| 126 | Command not executable | Found but not executable: missing chmod +x, or a directory. |
| 127 | Command not found | Not on PATH, or a script's #! interpreter does not exist (also shown for CRLF line endings). |
| 128 | Invalid exit argument | exit was called with a value outside 0-255. |
| 129 | SIGHUP (1) | Terminal closed; daemons often use it to reload configuration. |
| 130 | SIGINT (2) | Ctrl+C. |
| 131 | SIGQUIT (3) | Ctrl+\; dumps core. |
| 134 | SIGABRT (6) | abort(), a failed assertion or a corrupted heap. |
| 135 | SIGBUS (7) | Bus error, misaligned memory access. |
| 136 | SIGFPE (8) | Arithmetic error such as integer division by zero. |
| 137 | SIGKILL (9) | Killed outright: kill -9, or the kernel OOM killer. In Kubernetes this is OOMKilled when the container exceeded its memory limit. |
| 139 | SIGSEGV (11) | Segmentation fault: invalid memory access, often a native extension. |
| 141 | SIGPIPE (13) | Wrote to a pipe whose reader exited, e.g. a command piped into head. |
| 142 | SIGALRM (14) | Timer expired. |
| 143 | SIGTERM (15) | Polite stop: docker stop, systemctl stop, a Kubernetes pod shutting down. Should be handled and exit cleanly. |
| 152 | SIGXCPU (24) | CPU time limit (ulimit -t) exceeded. |
| 153 | SIGXFSZ (25) | File size limit exceeded. |
| 255 | Exit status out of range | exit -1 wraps to 255; ssh returns 255 when the connection itself fails. |
A process killed by a signal reports 128 plus the signal number, so 137 is 128 + 9. Signal numbers are for Linux on x86 and Arm; a few differ on macOS. 64-78 come from BSD's sysexits.h, which some tools follow and many ignore. Read the last status with echo $? in a shell.
About this tool
Method, assumptions, practical next steps, and limits.
128 plus the signal
When a signal kills a process, the shell reports 128 plus the signal's number. 130 is SIGINT from Ctrl+C, 137 is SIGKILL, 139 is SIGSEGV and 143 is SIGTERM. In Kubernetes, 137 with the reason OOMKilled means the container went over its memory limit; 143 is a normal shutdown request that the app should handle by finishing work and exiting. Signal numbers are listed in signal(7).
127 and 126
127 means the command was not found: a typo, a missing PATH entry under cron or systemd, or a script whose #! line names an interpreter that does not exist, which is also what a Windows line ending in a script produces. 126 means it was found but could not be executed, usually a missing execute permission.