Backspace (BS)

Move the cursor one column to the left without erasing the cell.

  1. 0x08
    BS

Hex: 0x08. ASCII: ^H (Ctrl+H).

Move the cursor one column to the left. BS does not erase the cell underneath the cursor; the cursor simply moves. To both move back and erase, applications typically send BS SP BS.

This sequence always unsets the pending wrap state. If the cursor was past the right edge in pending-wrap state, BS moves it back into the screen without performing the deferred wrap.

If the cursor is already at the leftmost column (or at the left margin when left/right margin mode is enabled), BS is a no-op by default.

This is equivalent to cursor backward (CUB) with Pn = 1, with the same wrap behavior derived from the active modes.

Note

When reverse wrap (DECRAW, mode 45) or extended reverse wrap is enabled together with autowrap, BS at the left edge can wrap the cursor up to the end of the previous row. This is mode-dependent and disabled by default.

Validation

BS V-1: Basic Move Back

printf "ABC"
printf "\b"
printf "X"
|ABX_______|

BS V-2: At Left Margin (No-Op)

printf "\033[1;1H" # move to top-left
printf "\b"
printf "X"
|Xc________|

BS V-3: Unsets Pending Wrap

cols=$(tput cols)
printf "\033[${cols}G" # move to last column
printf "A" # set pending wrap state
printf "\b"
printf "X"
|_________X|