Skip to main content

BS

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard

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
Formal syntax
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.

note

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​

SpecificationSection
ECMA-48§8.3.5

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓YesHandler backspace() at term/mod.rs:1398
Bobcat✓0.9.0Basic C0 control, handled in TerminalCtrl library
contour✓v0.1.0Implemented in executeControlCode; calls backspace()
foot✓YesImplemented in vt.c:136-166 with reverse wrap support
Ghostty✓v1.0.0Handled in stream.zig:768 as C0.BS (0x08)
iTerm2✓Yes
Kitty✓Yes
Konsole✓Yes
mintty✓YesHandled 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✓YesHandled in performer.rs:414 via ControlCode::Backspace, implements reverse-wraparound mode
Windows Terminal✓YesHandled via CursorBackward(1) dispatch in OutputStateMachineEngine.cpp:59-60
xterm✓YesImplemented in charproc.c:3701. Moves cursor left via CursorBack()
xterm.js✓2.3.0
Multiplexers
cy✓v0.1.0
GNU Screen✓v.4.2.0Implemented in Special() function at src/ansi.c:678
tmux✓0.8Implemented via screen_write_backspace()
tuios✓v0.0.15
Zellij✓v0.5.0-beta

See also​