What does exit code 1 mean in bash?
Exit code 1 is a general error — the command failed for an unspecified reason. Check stderr for the actual error message. It is the most common non-zero exit code and is used by most utilities to signal failure.
Quick Answer
Every bash command exits with a status code stored in `$?`. Zero means success; any non-zero value signals failure. When a cron job dies at 3am with no terminal attached, that number is often the only clue about what broke. Code 1 is a generic failure, 127 means the shell could not find the binary in `$PATH`, 130 means the process received SIGINT from Ctrl+C, and 137 typically means the Linux OOM killer sent SIGKILL. Ignoring `$?` lets a failed `cd` or `mkdir` cascade into commands running against the wrong directory. This browser tool maps any integer from 0 through 255 to a plain-English label, common causes, and representative commands that return that code. Type a number, browse the full table, or click Copy Handler to paste a trap block that prints the failing line and exits non-zero. The lookup runs entirely client-side — no install, no login, no data sent to a server.
Run this script on a real Linux server
Get $200 free credit — DigitalOcean
Get $200 Free →Affiliate link · we earn a commission
Need a domain for your next project?
Register with Namecheap — free WHOIS privacy included
Check Domain Prices →Affiliate link · we earn a commission
6 scripts + shared library + 52-page field guide. The production layer the free snippets don't cover.
Get the Toolkit →What does exit code 1 mean in bash?
Exit code 1 is a general error — the command failed for an unspecified reason. Check stderr for the actual error message. It is the most common non-zero exit code and is used by most utilities to signal failure.
What is exit code 127 in bash?
Exit code 127 means "command not found." The shell could not locate the binary in any of the directories listed in $PATH. Check that the command is installed and that its directory is in your PATH.
How do I check the exit code of the last command in bash?
Run `echo $?` immediately after the command. This prints the exit code of the most recently executed foreground command. In scripts, capture it with `exit_code=$?` before running anything else.
What exit code means success in bash?
Exit code 0 always means success in bash and all POSIX-compliant shells. Any non-zero value signals failure. This convention applies to every command, script, and function in the shell.
intermediate · error-handling
Bash Error Handling with set -euo pipefail
Bash silently continues after failed commands by default — a broken cd followed by rm -rf destroys the wrong directory. set -euo pipefail exits on first failure before damage spreads.
beginner · conditionals
Bash If/Else Examples
Comparison operator mistakes in bash scripts cause silent logic failures on unexpected input. Covers if/else, elif, integer and string test operators, file condition checks, and quoting safety.