CUP — Set cursor position
Move the cursor to absolute row/column (1-indexed).
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[row;colH\\033[
\033[1;1H\\e[
\e[1;1HESC [
ESC [ row ; col Hhex
1b 5b ... 48Description
Both `H` (CUP) and `f` (HVP) are synonyms — same behavior. Row and column are 1-based; omitting both defaults to (1,1), i.e. the top-left of the screen or scrolling region. Out-of-range values are clamped to the visible region.
Spec citation: ECMA-48 §8.3.21 (CUP)
Examples
printf '\033[2;5HHello at (2,5)\n'print('\x1b[2;5HHello at (2,5)')fmt.Print("\x1b[2;5HHello at (2,5)\n")process.stdout.write('\x1b[2;5HHello at (2,5)\n')printf("\x1b[2;5HHello at (2,5)\n");Terminal support
- xterm
- yes
- Linux console (fbcon)
- yes
- macOS Terminal.app
- yes
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- yes
- 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 | yes | yes | yes | yes | yes | yes | yes | no | no |