Exit Codes
A curated reference of standard Unix and Linux process exit codes drawn from three authoritative sources — POSIX (exit status 0 for success), Bash shell conventions (codes 1, 2, 126–143), and the BSD sysexits.h header (codes 64–78). Each entry includes the numeric code, a canonical name, a plain-English description of when it occurs, and the originating standard so developers can distinguish shell-specific behavior from portable POSIX semantics.
Quick fetch
Stable URL. CORS-enabled. No auth.
curl https://staticdata.dev/v1/exit-codes.json
Or use as a typed import:
import { exitCodes } from "https://staticdata.dev/v1/exit-codes.ts"
Formats
- JSON 6.7 KB
/v1/exit-codes.json
min: 5.7 KB · /v1/exit-codes.min.json
- CSV 4.2 KB
/v1/exit-codes.csv
- TypeScript 6.9 KB
/v1/exit-codes.ts
export const exitCodes
type ExitCode = (typeof exitCodes)[number]
Schema
Each record in the dataset has the following shape.
| Field | Type | Description | Example |
|---|---|---|---|
| code | number | Numeric exit code (0–255) | 0 |
| name | string | Short canonical name for the exit code | EX_USAGE |
| description | string | Plain-English explanation of when this code is used | The command was used incorrectly. |
| source | string | Originating standard: posix, bash, or sysexits | sysexits |
Preview
First 10 records.
| code | name | description | source |
|---|---|---|---|
| 0 | Success | The program completed successfully without errors. | posix |
| 1 | General Error | Catchall for general errors; miscellaneous errors such as 'divide by zero' or other impermissible operations. | bash |
| 2 | Misuse of Shell Builtins | Misuse of shell builtins (according to Bash documentation); missing keyword or command, or permission problem. | bash |
| 64 | EX_USAGE | The command was used incorrectly, e.g., with the wrong number of arguments, a bad flag, bad syntax in a parameter, etc. | sysexits |
| 65 | EX_DATAERR | The input data was incorrect in some way. This should only be used for user data and not system files. | sysexits |
| 66 | EX_NOINPUT | An input file (not a system file) did not exist or was not readable. | sysexits |
| 67 | EX_NOUSER | The user specified did not exist. This might be used for mail addresses or remote logins. | sysexits |
| 68 | EX_NOHOST | The host specified did not exist. This is used in mail addresses or network requests. | sysexits |
| 69 | EX_UNAVAILABLE | A service is unavailable. This can occur if a support program or file does not exist. | sysexits |
| 70 | EX_SOFTWARE | An internal software error has been detected. This should be limited to non-operating system related errors. | sysexits |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/exit-codes.json | jq '.[0]' import type { ExitCode } from "https://staticdata.dev/v1/exit-codes.ts";
const res = await fetch("https://staticdata.dev/v1/exit-codes.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const exitCodes: ExitCode[] = await res.json();
console.log(exitCodes[0]); import urllib.request, json
with urllib.request.urlopen("https://staticdata.dev/v1/exit-codes.min.json") as r:
exitCodes = json.load(r)
print(exitCodes[0]) package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://staticdata.dev/v1/exit-codes.min.json")
if err != nil { panic(err) }
defer resp.Body.Close()
var data []map[string]any
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
panic(err)
}
fmt.Println(data[0])
} use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let body = ureq::get("https://staticdata.dev/v1/exit-codes.min.json").call()?.into_string()?;
let data: Vec<Value> = serde_json::from_str(&body)?;
println!("{:?}", data.first());
Ok(())
} Sources and methodology
Exit codes (also called return codes or error codes) are the integer values a Unix process reports to its parent when it terminates. The value is available via $? in the shell or via waitpid(2) in C. Only the low 8 bits are meaningful, giving a usable range of 0–255. Code 0 universally means success per POSIX; any non-zero value signals some form of failure.
The BSD sysexits.h header, which originated with sendmail and appeared in BSD after 4.3BSD, defines codes 64–78 (EX_USAGE through EX_CONFIG) as a portable vocabulary for system programs. Sendmail, other mail transfer agents, and a number of BSD utilities use these values so callers can distinguish a configuration error from a temporary network failure without parsing stderr. POSIX shells layer additional reserved values on top: 126 (found but not executable), 127 (command not found), and 128+N for a process killed by signal N. Exit codes 129–143 therefore correspond to SIGHUP through SIGTERM; code 130 (128 + SIGINT) is by far the most commonly seen, produced whenever a user presses Ctrl+C.
Codes 3–63 and 79–125 are conventionally available for application-defined use, though several tools have established de-facto meanings (e.g., diff exits 1 for differences found, 2 for trouble; grep exits 1 for no match). Codes above 128 should be treated as signal-death indicators unless the application explicitly documents otherwise. Code 128 is listed by the Advanced Bash-Scripting Guide as “invalid argument to exit”, but current Bash actually exits with 2 in that case. Portability note: the 128+N values use Linux signal numbers. Several differ on macOS and the BSDs (there, 7 is SIGEMT, 10 is SIGBUS, 12 is SIGSYS and SIGUSR1/SIGUSR2 are 30/31), so codes 135, 138 and 140 are Linux-specific. Codes above 143 are platform-dependent and are not included in this dataset.
Versioning
URLs under /v1/ are stable: field names and types will not change in a way
that breaks consumers. Values can be corrected or records added when the upstream source
changes; schema-incompatible updates ship under a new version path. See the
exit-codes changelog for this dataset's history.
Related datasets
More Code datasets
- ansi-colors
- ascii
- cron-presets
- css-at-rules
- css-functions
- css-named-colors
- css-properties
- css-pseudo-classes
- css-pseudo-elements
- css-units
- data-units
- file-signatures
- hash-algorithms
- js-array-methods
- js-math-methods
- js-object-methods
- js-string-methods
- json-schema-keywords
- jwt-claims
- mathematical-constants
- measurement-units
- node-builtin-modules
- owasp-top-10
- periodic-table
- physical-constants
- programming-languages
- regex-flags
- regex-patterns
- roman-numerals
- si-base-units
- si-derived-units
- si-prefixes
- spdx-licenses
- strftime-tokens
- tailwind-colors
- time-units
- unicode-blocks
- unicode-general-categories
- unicode-planes
- unix-file-permissions
- xterm-256-colors