CBT — Cursor Backward Tabulation (CSI Z)
Move the cursor back N tab stops — the reverse of pressing Tab.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[NZ\033[1Z\e[1ZESC [ N Z1b 5b <N> 5aDescription
Cursor Backward Tabulation. Final byte `Z` (0x5a) moves the cursor backward to the previous tab stop, repeated N times (default 1 if the parameter is omitted). It is the mirror of CHT (`CSI Ps I`) and the moral opposite of pressing the Tab key (HT, 0x09). If the cursor is already at column 1 or before the first remaining tab stop, it stays put. Default tab stops live every 8 columns unless the application has cleared or shifted them with TBC (`\x1b[Ng`) and HTS (`\x1bH`). CBT is rarely emitted by humans, but matters for terminfo capability `cbt` and for any TUI replaying recorded keystrokes (Shift-Tab in form fields, etc.).
Spec citation: ECMA-48 §8.3.7 (CBT)
Examples
printf 'a\tb\tc\033[2Z|' # cursor jumps back 2 tab stops, then writes |import sys; sys.stdout.write('\x1b[2Z')fmt.Print("\x1b[2Z")process.stdout.write('\x1b[2Z')printf("\x1b[2Z");Terminal support
- xterm
- yes
- Linux console (fbcon)
- yes
- macOS Terminal.app
- yes
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- partial
- kitty
- yes
- alacritty
- yes
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- yes
- Konsole
- yes
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | yes | yes | yes | yes | partial | yes | yes | yes | yes | yes | yes | no | no |