DECSC / DECRC — Save and restore cursor
Push and pop the cursor state (position + attributes).
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b7 (save) \x1b8 (restore)\\033[
\0337 / \0338\\e[
\e7 / \e8ESC [
ESC 7 / ESC 8hex
1b 37 / 1b 38Description
DEC private 2-byte sequences (not CSI). DECSC (`ESC 7`) saves cursor position, current SGR attributes, charset selection, origin mode flag, and wraparound flag. DECRC (`ESC 8`) restores them. CSI alternatives `\x1b[s` (save) and `\x1b[u` (restore) are widely supported but historically save only the position. Most modern terminals treat both pairs identically.
Spec citation: DEC STD 070 / xterm-ctlseqs
Examples
printf '\0337move\033[5;5HHERE\0338back\n'print('\x1b7\x1b[5;5HHERE\x1b8')fmt.Print("\x1b7\x1b[5;5HHERE\x1b8")process.stdout.write('\x1b7\x1b[5;5HHERE\x1b8')printf("\x1b7\x1b[5;5HHERE\x1b8");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 |