Exit Codes Cheat Sheet: Shell Status Codes Explained
What each shell exit code means and how to debug a failing CI step.
The exit status conventions that decide whether a CI step passes or fails.
Common codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Misuse of shell builtin / bad args |
| 126 | Command found but not executable |
| 127 | Command not found |
| 128 | Invalid exit argument |
| 255 | Out-of-range exit status |
Signal-derived (128 + N)
| Code | Signal |
|---|---|
| 130 | SIGINT (Ctrl-C) |
| 137 | SIGKILL (often OOM-killed) |
| 139 | SIGSEGV (segfault) |
| 143 | SIGTERM |
Reading status
Terminal
cmd; echo "$?" # last exit code
if cmd; then ok; else fail; fi
set -e # exit on first non-zero
trap 'echo failed: $?' ERRKey takeaways
- 0 is success; any non-zero is failure to CI.
- 137 usually means an OOM kill (SIGKILL) - common in tight containers.
- Codes 128+N map to signal N (130 = Ctrl-C, 143 = SIGTERM).
Related guides
Unix Signals Cheat Sheet: SIGTERM, SIGKILL & HandlersA Unix signals cheat sheet - SIGTERM, SIGKILL, SIGINT, SIGHUP, default actions, and trapping signals for grac…
Bash Scripting Cheat Sheet: Variables, Tests & LoopsA bash scripting cheat sheet - variables, parameter expansion, test conditions, loops, functions, and strict-…
curl Cheat Sheet: Methods, Headers, Auth & DownloadsA curl cheat sheet - HTTP methods, headers, JSON bodies, auth, downloads, and the flags you use for API calls…