ASCII table
All 128 ASCII characters in decimal, hex, octal, binary and HTML, with notes on what they do in a shell script.
| Chr | Dec | Hex | Oct | Bin | HTML | Description |
|---|---|---|---|---|---|---|
| NUL | NullEnds a C string, and splits find -print0 output. | |||||
| SOH | Start of heading | |||||
| STX | Start of text | |||||
| ETX | End of textCtrl+C, sends SIGINT. | |||||
| EOT | End of transmissionCtrl+D, ends input or closes the shell. | |||||
| ENQ | Enquiry | |||||
| ACK | Acknowledge | |||||
| BEL | BellMakes the terminal beep. | |||||
| BS | BackspaceMoves the cursor one step back. | |||||
| TAB | Horizontal tabThe default IFS, with space and newline. | |||||
| LF | Line feedThe newline on Linux and macOS. | |||||
| VT | Vertical tab | |||||
| FF | Form feedCtrl+L, clears the screen. | |||||
| CR | Carriage returnWindows ends lines with CR LF, the cause of $'\r': command not found. | |||||
| SO | Shift out | |||||
| SI | Shift in | |||||
| DLE | Data link escape | |||||
| DC1 | Device control 1Ctrl+Q, XON, resumes output. | |||||
| DC2 | Device control 2Ctrl+R, reverse history search. | |||||
| DC3 | Device control 3Ctrl+S, XOFF, freezes output. | |||||
| DC4 | Device control 4 | |||||
| NAK | Negative acknowledgeCtrl+U, deletes to the start of the line. | |||||
| SYN | Synchronous idle | |||||
| ETB | End of transmission blockCtrl+W, deletes the word before the cursor. | |||||
| CAN | Cancel | |||||
| EM | End of medium | |||||
| SUB | SubstituteCtrl+Z, suspends the job. | |||||
| ESC | EscapeStarts every ANSI color code, like \e[1m. | |||||
| FS | File separatorCtrl+\, sends SIGQUIT. | |||||
| GS | Group separator | |||||
| RS | Record separator | |||||
| US | Unit separator | |||||
| SpaceSplits words, quote it in file names. | ||||||
| Exclamation markHistory expansion in an interactive shell, even inside double quotes. | ||||||
| Double quoteQuotes, but still expands $ and `. | ||||||
| Number signStarts a comment at the start of a word. | ||||||
| Dollar signExpands variables and $(commands). | ||||||
| Percent sign | ||||||
| AmpersandRuns in the background, && runs on success. | ||||||
| Single quoteQuotes everything, and cannot be escaped inside single quotes. | ||||||
| Left parenthesisStarts a subshell. | ||||||
| Right parenthesis | ||||||
| AsteriskGlob for any characters. | ||||||
| Plus sign | ||||||
| Comma | ||||||
| Hyphen-minus | ||||||
| Full stop | ||||||
| Slash | ||||||
| Digit 0 | ||||||
| Digit 1 | ||||||
| Digit 2 | ||||||
| Digit 3 | ||||||
| Digit 4 | ||||||
| Digit 5 | ||||||
| Digit 6 | ||||||
| Digit 7 | ||||||
| Digit 8 | ||||||
| Digit 9 | ||||||
| Colon | ||||||
| SemicolonEnds a command. | ||||||
| Less-than signRedirects input. | ||||||
| Equals sign | ||||||
| Greater-than signRedirects output, >> appends. | ||||||
| Question markGlob for one character. | ||||||
| At sign | ||||||
| Uppercase A | ||||||
| Uppercase B | ||||||
| Uppercase C | ||||||
| Uppercase D | ||||||
| Uppercase E | ||||||
| Uppercase F | ||||||
| Uppercase G | ||||||
| Uppercase H | ||||||
| Uppercase I | ||||||
| Uppercase J | ||||||
| Uppercase K | ||||||
| Uppercase L | ||||||
| Uppercase M | ||||||
| Uppercase N | ||||||
| Uppercase O | ||||||
| Uppercase P | ||||||
| Uppercase Q | ||||||
| Uppercase R | ||||||
| Uppercase S | ||||||
| Uppercase T | ||||||
| Uppercase U | ||||||
| Uppercase V | ||||||
| Uppercase W | ||||||
| Uppercase X | ||||||
| Uppercase Y | ||||||
| Uppercase Z | ||||||
| Left square bracketGlob for one character from a set, and the test command. | ||||||
| BackslashEscapes the next character. | ||||||
| Right square bracket | ||||||
| Caret | ||||||
| Underscore | ||||||
| BacktickThe old command substitution, prefer $( ). | ||||||
| Lowercase a | ||||||
| Lowercase b | ||||||
| Lowercase c | ||||||
| Lowercase d | ||||||
| Lowercase e | ||||||
| Lowercase f | ||||||
| Lowercase g | ||||||
| Lowercase h | ||||||
| Lowercase i | ||||||
| Lowercase j | ||||||
| Lowercase k | ||||||
| Lowercase l | ||||||
| Lowercase m | ||||||
| Lowercase n | ||||||
| Lowercase o | ||||||
| Lowercase p | ||||||
| Lowercase q | ||||||
| Lowercase r | ||||||
| Lowercase s | ||||||
| Lowercase t | ||||||
| Lowercase u | ||||||
| Lowercase v | ||||||
| Lowercase w | ||||||
| Lowercase x | ||||||
| Lowercase y | ||||||
| Lowercase z | ||||||
| Left curly bracketBrace expansion, like {1..10}. | ||||||
| Vertical barPipes output to the next command. | ||||||
| Right curly bracket | ||||||
| TildeExpands to $HOME at the start of a word. | ||||||
| DEL | DeleteWhat the Backspace key sends in most terminals. |
Good to know
- Click any cell to copy it. The control characters have no glyph, so copy one of their codes instead.
$'…'is Bash ANSI-C quoting, it turns\eor\x1Binto the real byte. Plainechodoes not, useprintf '\e[1mBold\e[0m'for something that works in every shell.- Ctrl plus a key sends the code 64 lower, so Ctrl+C sends 3.
cat -vprints them the same way, as^C, and^[is Escape, so Ctrl+[ works when Esc is out of reach. - Press Ctrl+V before a key to type it literally, like Ctrl+V Tab to put a real tab in the command line.
- Get the code of a character with
printf '%d' "'A", and the character back withprintf "\x$(printf '%x' 65)". - See the hidden bytes in a file with
od -corxxd, handy for spotting a stray\rfrom Windows.