CSI ? Ps n — Private DSR (extended status queries)
DEC private Device Status Reports — extended cursor position (?6 DECXCPR with page), printer / UDK / locator / macro-space / memory-checksum status.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[?<Ps>n\033[?6n\e[?6nESC [ ? Ps n1b 5b 3f ... 6eDescription
The `?` prefix flips the standard DSR (`\x1b[<Ps>n`) into DEC's private DSR namespace, where Ps values have different — extended — meanings. **`?6n` DECXCPR** (Extended Cursor Position Report) is the most useful: terminals reply `\x1b[?<row>;<col>;<page>R` adding the active display page number — the original DSR-6 reply (`\x1b[<row>;<col>R`) omits the page. Other useful queries: **`?15n`** printer status — reply `\x1b[?10n` (ready) / `?11n` (not ready) / `?13n` (no printer); **`?25n`** UDK lock status — reply `\x1b[?20n` (unlocked) / `?21n` (locked); **`?26n`** keyboard dialect — reply `\x1b[?27;<Ps>;<Pm>;<Pp>n` where Ps = language (1 = North American, 2 = British, …); **`?53n`** / **`?55n`** locator status; **`?62n`** macro space — reply `\x1b[<Pn>*{` (bytes of macro space free); **`?63;Ps n`** memory checksum — reply `DCS Pp ! ~ Ps ! Pchecksum ST`; **`?75n`** data integrity report; **`?85n`** multiple session status. Most modern emulators implement at most `?6n` plus a stub `?13n` (no printer) — the rest reply with the silently-ignored bytes or no reply at all. Use DECRQM (`\x1b[<Ps>$p`) for mode state queries; reserve private DSR for the few queries above.
Spec citation: DEC VT510 RM (private DSR) / xterm-ctlseqs
Parameters
| Ps | Private DSR selector. Common: `6` extended cursor pos (DECXCPR), `15` printer, `25` UDK, `26` keyboard, `53/55` locator, `62` macro space, `63;n` checksum, `75` data integrity, `85` session count. |
Examples
printf '\033[?6n' # DECXCPR — reply: \x1b[?<row>;<col>;<page>Rimport sys; sys.stdout.write('\x1b[?15n'); sys.stdout.flush() # query printer statusfmt.Print("\x1b[?26n") // query keyboard dialectprocess.stdout.write('\x1b[?62n') // macro-space available bytesprintf("\x1b[?6n"); /* DECXCPR — get cursor pos + active page */Terminal support
- xterm
- yes
- Linux console (fbcon)
- partial
- macOS Terminal.app
- partial
- iTerm2
- partial
- Windows Terminal
- partial
- cmd.exe / ConPTY
- no
- kitty
- partial
- alacritty
- partial
- WezTerm
- partial
- Ghostty
- partial
- GNOME Terminal
- partial
- Konsole
- partial
- 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 | partial | partial | partial | no | partial | partial | partial | partial | partial | partial | no | no |