# Exit Code

say it: **“EG-zit KOHD”** **/ˈɛɡzɪt ˈkoʊd/**

The number a command returns: 0 for success, other values for errors.

## What is **Exit Code**?

Every command finishes with an **exit code**: `0` means success, anything else means an error. `$?` holds the last one.

```bash
ls missing-folder
echo $?   # 2

mkdir backups && echo "created"   # only runs if mkdir succeeded
```

Level: Journeyman · [More Unix terms at this level](https://www.ask-codey.com/glossary?category=unix&level=3)

Updated: November 17, 2026

## In other subjects

- [Exit Code in Operating System](https://www.ask-codey.com/glossary/exit-code-operating-system)

Source: https://www.ask-codey.com/glossary/exit-code
