DECSCUSR — Cursor shape
Change the cursor shape: block, underline, or bar (with optional blink).
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[N\x20q (N = 0..6)\\033[
\033[1 q\\e[
\e[1 qESC [
ESC [ N SP qhex
1b 5b <N> 20 71Description
Set Cursor Style. The parameter selects shape and blink: `0` or `1` = blinking block (default), `2` = steady block, `3` = blinking underline, `4` = steady underline, `5` = blinking bar (vertical line), `6` = steady bar. The intermediate byte is a literal SPACE (0x20) before the final `q`. Vim's `t_SI`/`t_EI` and many shells use `\x1b[6 q` (bar) for insert mode and `\x1b[2 q` (block) for normal mode. Restore your terminal default with `\x1b[0 q` on exit.
Spec citation: xterm-ctlseqs (DECSCUSR, CSI Ps SP q)
Parameters
| 0 | user-default cursor |
| 1 | blinking block |
| 2 | steady block |
| 3 | blinking underline |
| 4 | steady underline |
| 5 | blinking bar |
| 6 | steady bar |
Examples
printf '\033[6 q' # vertical bar (insert mode)\nprintf '\033[2 q' # block (normal mode)\nprintf '\033[0 q' # restore defaultimport sys; sys.stdout.write('\x1b[6 q')fmt.Print("\x1b[6 q")process.stdout.write('\x1b[6 q')printf("\x1b[6 q");Terminal support
- xterm
- yes
- Linux console (fbcon)
- partial
- macOS Terminal.app
- yes
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- partial
- 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 | partial | yes | yes | yes | partial | yes | yes | yes | yes | yes | yes | no | no |
Related sequences
In the family cookbook
CSI cookbook · 6. Insert / delete / cursor shape — IL / DL / ICH / DCH / ECH + DECSCUSR