CHA — Cursor horizontal absolute (column)
Move the cursor to column N of the current row (1-indexed).
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[NG\\033[
\033[1G\\e[
\e[1GESC [
ESC [ N Ghex
1b 5b <N> 47Description
Final byte `G` = CHA (Cursor Horizontal Absolute). Sets the column without changing the row; N defaults to 1. Commonly paired with EL (`\x1b[K`) to redraw the current line: `\x1b[1G\x1b[K` jumps to column 1 and clears to end — equivalent to `\r\x1b[K` for most CRLF terminals but cleanly avoids any line-feed semantics. HPA (`\x1b[N\``, final-byte `` ` ``) is the ECMA-48 synonym; both are widely supported.
Spec citation: ECMA-48 §8.3.9 (CHA)
Examples
printf 'progress:\033[20G50%%\033[1G' print('\x1b[20G50%')fmt.Print("\x1b[20G50%")process.stdout.write('\x1b[20G50%')printf("\x1b[20G50%%");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 |
Related sequences
In the family cookbook
CSI cookbook · 2. Cursor movement — CUU / CUD / CUF / CUB + CUP + CHA / VPA