SCOSC / SCORC — Save / Restore cursor (CSI s / u)
CSI-style save (s) and restore (u) of cursor position — distinct from ESC 7 / ESC 8 (DECSC / DECRC).
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[s (save) \x1b[u (restore)\033[s / \033[u\e[s / \e[uESC [ s / u1b 5b 73 / 75Description
Save Cursor Position (SCOSC, final byte `s`, 0x73) and Restore Cursor Position (SCORC, final byte `u`, 0x75). Originally from the SCO ANSI terminal; xterm, VTE, ConPTY, and Windows Terminal all honour them today. They are NOT the same as the older DEC pair DECSC (`\x1b7`) / DECRC (`\x1b8`): SCOSC/SCORC save ONLY the position (row + column), whereas DECSC also saves SGR attributes, character-set state, and origin mode. There is exactly ONE save slot — calling SCOSC again overwrites the prior save. Caveat: `\x1b[s` collides with DECSLRM (Set Left/Right Margins) when LRMM mode (`?69h`) is active; under standard xterm defaults LRMM is OFF and `s` is unambiguous.
Spec citation: xterm-ctlseqs (SCOSC / SCORC, CSI s / u)
Examples
printf 'a\033[sBCD\033[u_' # save after 'a', write BCD, restore, write _ -> 'a_CD'import sys; sys.stdout.write('\x1b[s'); ...; sys.stdout.write('\x1b[u')fmt.Print("\x1b[s"); /* ... */ fmt.Print("\x1b[u")process.stdout.write('\x1b[s'); /* ... */ process.stdout.write('\x1b[u')printf("\x1b[s"); /* ... */ printf("\x1b[u");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