SUMMARY According to `man console_codes` the CSI sequence > ESC [ 3 J: erase whole display including scroll-back buffer but Konsole implements it as simply clearing the scrollback buffer without erasing the display. STEPS TO REPRODUCE 1. Run something to have text on screen and scrollback buffer. 2. Execute following command printf "\033[3J" OBSERVED RESULT Terminal scrollback buffer is deleted but the text visible on the terminal is not touched. EXPECTED RESULT There should be no visible text and the scrollback buffer should be empty. Tested with Ubuntu 22.04 LTS and Konsole version 21.12.3. $ apt-cache policy konsole konsole: Installed: 4:21.12.3-0ubuntu1 Candidate: 4:21.12.3-0ubuntu1 Version table: *** 4:21.12.3-0ubuntu1 500 500 http://fi.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages 100 /var/lib/dpkg/status
CSI 3 J comes from xterm, where it only clears the scrollback buffer. VTE (gnome-terminal, xfce-terminal, ...) behaves likewise. Putty also follows that behavior. See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ : CSI Ps J Erase in Display (ED), VT100. Ps = 0 ⇒ Erase Below (default). Ps = 1 ⇒ Erase Above. Ps = 2 ⇒ Erase All. Ps = 3 ⇒ Erase Saved Lines, xterm. So, CSI 2 J erases all the screen, but not the scrollback buffer, while CSI 3 J erases the scrollback buffer, but not the screen.