SU / SD — Scroll up / down
Scroll the screen contents up (SU) or down (SD) by N lines without moving the cursor.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[NS (scroll up) \x1b[NT (scroll down)\033[1S / \033[1T\e[1S / \e[1TESC [ N S / T1b 5b <N> 53 / 54Description
Final byte `S` = SU (Scroll Up), `T` = SD (Scroll Down). Both shift the scrolling region's contents by N rows (defaulting to 1 if omitted) and fill the exposed rows with blanks; the cursor position is unchanged. SU `\x1b[1S` makes the top row disappear and a blank row appear at the bottom — the inverse of how a fresh line of text scrolls the screen on its own. Scroll-region semantics apply: if DECSTBM (`\x1b[t;b r`) has restricted the region, only those rows scroll.
Spec citation: ECMA-48 §8.3.147 (SU) / §8.3.113 (SD)
Parameters
| S | scroll up by N rows |
| T | scroll down by N rows |
Examples
printf 'top\nmid\nbot\033[2S' # scroll region up 2import sys; sys.stdout.write('\x1b[1S')fmt.Print("\x1b[1S")process.stdout.write('\x1b[1S')printf("\x1b[1S");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 · 5. Margins & scroll region — DECSTBM `r` and DECSLRM `s`