Skip to main content

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​

ValueMeaning
0Erase from cursor to end of line (default)
1Erase from start of line to cursor
2Erase 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 K or CSI 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​

SpecificationSection
ECMA-48—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓0.1.0Implemented via clear_line method
Bobcat✓0.9.0Supported via TerminalCtrl library
contour✓v0.1.0
foot✓YesEL (K) modes 0, 1, 2 at csi.c:1007-1045
Ghostty✓v1.0.0
iTerm2✓YesVT100CSI_EL token parsed with parameter handling for modes 0, 1, 2 via terminalEraseLineBeforeCursor:afterCursor:
Kitty✓YesEL (CSI K) with modes 0/1/2 fully implemented in screen.c:2380-2421
Konsole✓YesEL with parameters 0, 1, 2 implemented at src/Vt102Emulation.cpp:2017-2019
mintty✓YesEL (CSI K) at line 3198-3203, supports parameters 0, 1, 2
mlterm✓rel-2_9_0Implemented 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✓YesFully implemented in vteseq.cc, supports modes 0, 1, 2
WezTerm✓YesEL implemented as Edit::EraseInLine with EraseInLine::{EraseToEndOfLine, EraseToStartOfLine, EraseLine}
Windows Terminal✓YesImplemented 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.6EL (CSI K) with parameters 0, 1, 2 all implemented
tuios✓v0.0.15
Zellij✓v0.1.0-alpha

See also​