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, BS is a no-op. By default the move is clamped to column 1 and the left margin is not consulted at all; the left margin only bounds the move when one of the reverse wrap modes below is enabled.

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

Note

When reverse wrap (XTREVWRAP, mode 45) or extended reverse wrap (XTREVWRAP2, mode 1045) 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"
|ABXc______|

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"
|________XA|

Printing A in the last column leaves the cursor there with pending wrap set. BS moves it one column left and clears the flag, so the X lands to the left of the A rather than on top of it.