Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • It is specifically specified by POSIX to reset the terminal "in an implementation-defined manner". For example, on my system, it does absolutely nothing (in particular, it does not clear the screen nor the scrollback buffer). Commented Feb 13, 2024 at 14:24
  • @Kusalananda Wow! I didn't expect any terminal to reset without clearing the screen. Which terminal emulator do you use? Commented Feb 13, 2024 at 15:02
  • Konsole is the only terminal I use that doesn't clear the scrollback with tput reset. It seems that Konsole version 21.12.3 requires <ESC>c to clear the screen and <ESC>[3J to delete the scrollback buffer but that doesn't clear the screen. As a result, echo -ne '\e[3J\ec' should be able to clear the scrollback and the screen but this is not portable. Commented Feb 13, 2024 at 15:20
  • 1
    iTerm on macOS, with an SSH session running tmux inside on an OpenBSD system. That tput reset command does clear the terminal in iTerm locally, but does not reset the scrollback buffer. Commented Feb 13, 2024 at 17:29