BS
BS (Backspace) is a C0 control character that moves the cursor one position to the left. It is one of the oldest control characters, present since the original ASCII standard.
Syntax
BS 0x08
BS = 0x08 ;
Description
Per ECMA-48 §8.3.5, BS "causes the active data position to be moved one character position in the data component in the direction opposite to that of the implicit movement."
In standard terminal usage with left-to-right writing, this means the cursor moves one column to the left. The character at the cursor position is not erased — BS only moves the cursor. To delete a character, a terminal application typically sends BS SP BS (backspace, space, backspace) to overwrite the character with a space.
If the cursor is already at the left margin (column 1), BS has no effect. BS does not wrap to the previous line.
In the context of a line discipline (e.g., canonical mode in Unix), the kernel's terminal driver typically interprets the erase character (often mapped to backspace) by sending BS SP BS to the terminal. The BS control character itself only moves the cursor.
Examples
printf 'ABC\b\b' # Prints "ABC" then moves cursor back to 'B'
printf 'AB\b \bA' # Prints "AB", erases 'B', prints 'A' → "AA"
Specifications
| Specification | Section |
|---|---|
| ECMA-48 | §8.3.5 |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | Yes | Handler backspace() at term/mod.rs:1398 |
| Bobcat | ✓ | 0.9.0 | Basic C0 control, handled in TerminalCtrl library |
| contour | ✓ | v0.1.0 | Implemented in executeControlCode; calls backspace() |
| foot | ✓ | Yes | Implemented in vt.c:136-166 with reverse wrap support |
| Ghostty | ✓ | v1.0.0 | Handled in stream.zig:768 as C0.BS (0x08) |
| iTerm2 | ✓ | Yes | |
| Kitty | ✓ | Yes | |
| Konsole | ✓ | Yes | |
| mintty | ✓ | Yes | Handled in do_ctrl() at src/termout.c:1691 |
| mlterm | ✓ | rel-0_2_1 | |
| PuTTY | ✓ | 0.45 | |
| Rio | ✓ | v0.0.28 | |
| rxvt-unicode | ✓ | rxvt-unicode-1.2 | |
| st | ✓ | 0.6 | |
| terminology | ✓ | v0.1.0 | |
| VT100 | ✓ | Yes | |
| VTE | ✓ | Yes | |
| WezTerm | ✓ | Yes | Handled in performer.rs:414 via ControlCode::Backspace, implements reverse-wraparound mode |
| Windows Terminal | ✓ | Yes | Handled via CursorBackward(1) dispatch in OutputStateMachineEngine.cpp:59-60 |
| xterm | ✓ | Yes | Implemented in charproc.c:3701. Moves cursor left via CursorBack() |
| xterm.js | ✓ | 2.3.0 | |
| Multiplexers | |||
| cy | ✓ | v0.1.0 | |
| GNU Screen | ✓ | v.4.2.0 | Implemented in Special() function at src/ansi.c:678 |
| tmux | ✓ | 0.8 | Implemented via screen_write_backspace() |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.5.0-beta | |
See also
- CUU/CUD/CUF/CUB — Cursor Movement — CSI-based cursor movement sequences