Reference

Exit codes & signals.

What a command's exit status means, and the signals you send with kill.

Tap any row to copy the value in the first column.

Bash exit status

CodeMeaningNotes
0SuccessCommand completed without error
1General errorCatch-all for a failure
2Misuse of a builtinWrong usage or syntax
126Not executableFound but lacks execute permission
127Command not foundTypo or not in PATH
128Invalid exit argumentexit called with a bad value
130Ended by Ctrl-CTerminated by SIGINT (128 + 2)
137KilledSIGKILL (128 + 9) — often out of memory
143TerminatedSIGTERM (128 + 15)
255Out of rangeExit code above 255 wraps around

Common signals

SignalNo.Meaning
SIGHUP1Hang-up; often used to reload config
SIGINT2Interrupt from the keyboard (Ctrl-C)
SIGQUIT3Quit and dump core
SIGKILL9Force kill — cannot be caught or ignored
SIGSEGV11Segmentation fault (bad memory access)
SIGTERM15Polite request to terminate (default kill)
SIGSTOPPause a process — cannot be caught
SIGCONTResume a paused process
SIGUSR1User-defined signal 1
Signal numbers 1, 2, 3, 9, 11 and 15 are the same on Linux and macOS, but a few (SIGSTOP, SIGCONT, SIGUSR1) have different numbers across systems — use the name with kill to be safe (e.g. kill -TERM).

Reading an exit status

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.

FAQ

What does exit code 127 mean?
Command not found. The shell couldn't locate the command — usually a typo, a missing program, or something not on your PATH. Code 126 is similar but means the file was found and isn't executable.
What's the difference between SIGTERM and SIGKILL?
SIGTERM (15) politely asks a process to shut down, so it can save state and clean up — it's what plain kill sends. SIGKILL (9) forces it to stop immediately and can't be caught or ignored, so use it only when SIGTERM doesn't work.

More references