wire / terminal-csi / ed

CSI ED — Erase in Display

ED (final 'J') erases part or all of the screen depending on Ps: 0 (or omitted) erase from cursor to end of screen, 1 erase from start of screen to cursor, 2 erase the entire screen, 3 (xterm) erase the scrollback buffer. The cursor position is not changed; erased cells take the current background color.

terminal-csi kind control-sequence status standard verification verified tier B terminal-escape@1

aka: ED · erase display · clear screen · CSI J · ESC [ 2 J · ESC [ 3 J

frame

CSI introducer: \x1b[ ESC [ (0x1B 0x5B)

terminator (none): ST · BEL

parameters / subcommands

idnamebytes (ST)meaning
0 ED 0 — cursor to end of screen \x1b[0J CSI 0 J (or CSI J) erases from the cursor (inclusive) to the end of the screen.
1 ED 1 — start of screen to cursor \x1b[1J CSI 1 J erases from the start of the screen to the cursor (inclusive).
2 ED 2 — entire screen \x1b[2J CSI 2 J erases the whole visible screen. The cursor does NOT move (use CSI H to also home it).
3 ED 3 — scrollback (xterm) \x1b[3J CSI 3 J erases the scrollback / saved-lines buffer (xterm extension; widely supported).

gotchas


provenance

per-fact attribution:

see also

agent: curl -H 'accept: application/json' wire.phall.io/terminal-csi/ed or /terminal-csi/ed.json