shell
Shell Exit Codes
Exit codes used by POSIX shells (bash, sh, zsh) to indicate the result of a command or script. Codes 128+N indicate termination by signal N.
38 codes
references gnu.org/software/bash/manual/bash.htmlpubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
· All codes 38 codes
- 0 Success The command completed successfully.
- 1 General error A general or unspecified error occurred. Many programs use this as a catch-all failure code.
- 2 Misuse of shell built-in Incorrect usage of a shell built-in command, such as missing or invalid arguments.
- 126 Command cannot execute The command was found but could not be executed, typically due to missing execute permission.
- 127 Command not found The command was not found in PATH. Check for a typo or a missing installation.
- 128 Invalid exit argument The exit command was called with an invalid argument (non-integer or out of range).
- 129 Terminated by SIGHUP The process was terminated by SIGHUP (signal 1), typically when the controlling terminal is closed.
- 130 Terminated by SIGINT The process was interrupted by SIGINT (signal 2), typically via Ctrl-C.
- 131 Terminated by SIGQUIT The process was terminated by SIGQUIT (signal 3), typically via Ctrl-Backslash. A core dump may have been produced.
- 132 Terminated by SIGILL The process was terminated by SIGILL (signal 4) due to an illegal instruction.
- 133 Terminated by SIGTRAP The process was terminated by SIGTRAP (signal 5), typically from a debugger breakpoint.
- 134 Terminated by SIGABRT The process was terminated by SIGABRT (signal 6), typically via a call to abort().
- 135 Terminated by SIGBUS The process was terminated by SIGBUS (signal 7) due to a bus error — typically an unaligned memory access or access beyond a memory-mapped region.
- 136 Terminated by SIGFPE The process was terminated by SIGFPE (signal 8) due to a floating-point or arithmetic exception, such as integer division by zero.
- 137 Terminated by SIGKILL The process was killed by SIGKILL (signal 9). This signal cannot be caught or ignored.
- 138 Terminated by SIGUSR1 The process was terminated by SIGUSR1 (signal 10), a user-defined signal. The sending process used it as an application-specific notification.
- 139 Terminated by SIGSEGV The process was terminated by SIGSEGV (signal 11) due to a segmentation fault — an invalid memory access.
- 140 Terminated by SIGUSR2 The process was terminated by SIGUSR2 (signal 12), a user-defined signal. The sending process used it as an application-specific notification.
- 141 Terminated by SIGPIPE The process was terminated by SIGPIPE (signal 13) because it wrote to a pipe with no reader.
- 142 Terminated by SIGALRM The process was terminated by SIGALRM (signal 14) when an alarm timer set via alarm(2) expired and the signal was not handled.
- 143 Terminated by SIGTERM The process was terminated by SIGTERM (signal 15), the standard graceful termination signal.
- 144 Terminated by SIGSTKFLT The process was terminated by SIGSTKFLT (signal 16), a Linux-specific signal originally for math coprocessor stack faults. Rarely seen in practice.
- 145 Terminated by SIGCHLD The process was terminated by SIGCHLD (signal 17). Unusual, as SIGCHLD is normally ignored or handled; termination indicates an explicit kill with this signal number.
- 146 Terminated by SIGCONT The process was terminated by SIGCONT (signal 18). Unusual, as SIGCONT normally resumes a stopped process; termination indicates an explicit kill with this signal number.
- 147 Terminated by SIGSTOP The process was stopped by SIGSTOP (signal 19). SIGSTOP cannot be caught or ignored; the shell reports exit code 147 when a job is stopped by this signal.
- 148 Stopped by SIGTSTP The process was stopped by SIGTSTP (signal 20), typically via Ctrl-Z at the terminal. Use fg or SIGCONT to resume it.
- 149 Stopped by SIGTTIN The process was stopped by SIGTTIN (signal 21) because a background process attempted to read from its controlling terminal.
- 150 Stopped by SIGTTOU The process was stopped by SIGTTOU (signal 22) because a background process attempted to write to its controlling terminal while TOSTOP was set.
- 151 Terminated by SIGURG The process was terminated by SIGURG (signal 23). Unusual, as SIGURG is normally ignored; termination indicates an explicit kill with this signal number.
- 152 Terminated by SIGXCPU The process was terminated by SIGXCPU (signal 24) after exceeding its CPU time limit set via setrlimit(2).
- 153 Terminated by SIGXFSZ The process was terminated by SIGXFSZ (signal 25) after attempting to create a file larger than the file size limit set via setrlimit(2).
- 154 Terminated by SIGVTALRM The process was terminated by SIGVTALRM (signal 26) when a virtual interval timer (counting user-mode CPU time) expired and the signal was not handled.
- 155 Terminated by SIGPROF The process was terminated by SIGPROF (signal 27) when a profiling timer expired and the signal was not handled.
- 156 Terminated by SIGWINCH The process was terminated by SIGWINCH (signal 28). Unusual, as SIGWINCH is normally ignored; termination indicates an explicit kill with this signal number.
- 157 Terminated by SIGIO The process was terminated by SIGIO (signal 29). Unusual, as SIGIO is normally ignored; termination indicates an explicit kill with this signal number.
- 158 Terminated by SIGPWR The process was terminated by SIGPWR (signal 30), a Linux-specific signal indicating a power failure event.
- 159 Terminated by SIGSYS The process was terminated by SIGSYS (signal 31) due to a bad system call argument or a syscall blocked by a seccomp filter.
- 255 Exit status out of range Exit status is out of the 0–255 range. Some shells clamp or wrap exit codes to one byte.