DL — Delete Line (CSI Pn M)
Remove N lines starting at the cursor row and pull subsequent lines up within the scrolling region — vim's 'dd' command primitive.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[PnM\033[PnM\e[PnMESC [ Pn M1b 5b <Pn> 4dDescription
Delete Line. Final byte `M` (0x4d) removes `Pn` lines starting at the cursor row (default 1); every line below them inside the active scrolling region (DECSTBM) is pulled upward by `Pn`, and `Pn` fresh blank lines appear at the bottom of the region with the current SGR background. Cursor moves to column 1 of its row (same xterm-vs-spec column-reset behaviour as IL). DL is the primitive `vim`'s `dd` command emits, what `less` uses to scroll a line at the top off-screen, and what `tmux`'s pane resize relies on. Counterpart is IL (`\x1b[Pn L`); used together with `\x1b[T;Br` (DECSTBM) you get atomic small-region scrolls without redrawing the whole screen. Terminfo cap: `dl1` (Pn=1) or `dl` (parameterised).
Spec citation: ECMA-48 §8.3.32 (DL)
Examples
# Set scroll region rows 1..5, position cursor at row 2, delete 1 line.\nprintf '\033[1;5r\033[2;1H\033[1M'import sys; sys.stdout.write('\x1b[1M')fmt.Print("\x1b[1M")process.stdout.write('\x1b[1M')printf("\x1b[1M");Terminal support
- xterm
- yes
- Linux console (fbcon)
- yes
- 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 | yes | 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