EL
AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard
EL (Erase in Line) is a CSI sequence that erases part or all of the current line.
Syntax
CSI Ps K EL — Erase in Line
Formal syntax
EL = 0x1b, "[", [ Ps ], "K" ; Ps = "0" | "1" | "2" ; (* default: 0 *)
Parameters
| Value | Meaning |
|---|---|
0 | Erase from cursor to end of line (default) |
1 | Erase from start of line to cursor |
2 | Erase the entire line |
Description
Per ECMA-48 §8.3.41, EL puts character positions on the active line into the erased state depending on the parameter value. The cursor position does not change for any variant.
CSI 0 KorCSI K— Erases from the cursor position (inclusive) through the end of the line.CSI 1 K— Erases from the beginning of the line through the cursor position (inclusive).CSI 2 K— Erases the entire line.
"Erased state" means the positions are filled with the current background color (as set by SGR).
DECSEL
The selective erase variant CSI ? Ps K (DECSEL) erases only characters not written with the "protected" attribute. Most applications use the non-selective form.
Examples
printf '\e[K' # Erase from cursor to end of line
printf '\e[1K' # Erase from start of line to cursor
printf '\e[2K' # Erase entire line
Specifications
| Specification | Section |
|---|---|
| ECMA-48 | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | 0.1.0 | Implemented via clear_line method |
| Bobcat | ✓ | 0.9.0 | Supported via TerminalCtrl library |
| contour | ✓ | v0.1.0 | |
| foot | ✓ | Yes | EL (K) modes 0, 1, 2 at csi.c:1007-1045 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | Yes | VT100CSI_EL token parsed with parameter handling for modes 0, 1, 2 via terminalEraseLineBeforeCursor:afterCursor: |
| Kitty | ✓ | Yes | EL (CSI K) with modes 0/1/2 fully implemented in screen.c:2380-2421 |
| Konsole | ✓ | Yes | EL with parameters 0, 1, 2 implemented at src/Vt102Emulation.cpp:2017-2019 |
| mintty | ✓ | Yes | EL (CSI K) at line 3198-3203, supports parameters 0, 1, 2 |
| mlterm | ✓ | rel-2_9_0 | Implemented at vt_parser.c:5675-5684 |
| PuTTY | ✓ | 0.45 | |
| Rio | ✓ | v0.0.3 | |
| rxvt-unicode | ✓ | 1.2 | |
| st | ✓ | 0.1 | |
| terminology | ✓ | v0.1.0 | |
| VT100 | ✓ | Yes | |
| VTE | ✓ | Yes | Fully implemented in vteseq.cc, supports modes 0, 1, 2 |
| WezTerm | ✓ | Yes | EL implemented as Edit::EraseInLine with EraseInLine::{EraseToEndOfLine, EraseToStartOfLine, EraseLine} |
| Windows Terminal | ✓ | Yes | Implemented in ITermDispatch.hpp:99 as EraseInLine |
| xterm | ✓ | xterm-406 | |
| xterm.js | ✓ | 2.3.0 | |
| Multiplexers | |||
| cy | ✓ | v0.1.0 | |
| GNU Screen | ✓ | v.4.2.0 | |
| tmux | ✓ | 1.6 | EL (CSI K) with parameters 0, 1, 2 all implemented |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.1.0-alpha | |
See also
- ED — Erase in Display — Erase regions of the screen
- ECH — Erase Character — Erase a specific number of characters