IL — Insert Line (CSI Pn L)
Open N blank lines at the cursor row and push subsequent lines down within the scrolling region — vim's 'O' command primitive.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[PnL\033[PnL\e[PnLESC [ Pn L1b 5b <Pn> 4cDescription
Insert Line. Final byte `L` (0x4c) inserts `Pn` blank lines at the cursor row (default 1); every subsequent line inside the active scrolling region (DECSTBM, default = full screen) is pushed downward by `Pn`, and the `Pn` lines that would fall below the bottom margin are discarded. Cells in the freshly-inserted blank lines carry the current SGR background. The cursor moves to column 1 of its row (ECMA-48 says column unchanged, but most modern terminals follow the xterm convention of resetting to column 1 because that's what every TUI app expects). Used by `vim`'s `O` command (open line above), `tmux`'s pane re-layout, and any `less`-style scroll-up-by-N. Counterpart is DL (`\x1b[Pn M`). Terminfo cap: `il1` (Pn=1) or `il` (parameterised).
Spec citation: ECMA-48 §8.3.67 (IL)
Examples
# Set scroll region rows 1..5, position cursor at row 3, insert 2 blank lines.\nprintf '\033[1;5r\033[3;1H\033[2L'import sys; sys.stdout.write('\x1b[2L') # insert 2 lines at cursor rowfmt.Print("\x1b[2L")process.stdout.write('\x1b[2L')printf("\x1b[2L");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