0

I know cls and clear exist. But after using these commands I can still scroll up and see my history. I want it to behave like a real reopening of the window.

Any help?

1

As the other stated, reset should do the trick. However, some terminal emulator (mintty from Cygwin if I'm right) doesn't even clear the scrollback buffer. In this case, they should have an option to do that directly. In mintty there is something like "Clear scrollback" when you do a right click in the window, or open the menu.

  • Thanks for your help. It's indeed selectable in the Putty right click menu – Ozkan Mar 5 '14 at 14:30
3

Try reset: this clears the scrollback buffer in the terminal programs I've tried (xfce4-terminal, gnome-terminal and xterm).

  • 1
    works in Terminal.app on os X too, BTW. – stib Mar 5 '14 at 12:32
  • If I do reset then it says: Erase is control-H (^H).. And control-H does nothing – Ozkan Mar 5 '14 at 12:34
  • but does it clear your scrollback? – Flup Mar 5 '14 at 12:34
  • No, my cursor is moved to top (like cls does) but I can still scroll up and see my history – Ozkan Mar 5 '14 at 12:47
  • Can you tell us what shell and terminal program you're using? – Flup Mar 5 '14 at 13:28
1

In some terminals (xterm), ctrl-L clears the screen like reset, but faster. However in gnome-terminal ctrl-L behaves like clear.

Since I can't yet comment, just want to point out that Putty provides it's own terminal, unleses you use X11 tunneling.

Edit:

If you wish to clear the scrollback buffer via the command-line, use a previous superuser answer PuTTY: clear scrollback from commandline. This can be aliased as alias reset="clear && printf '\033[3J'".

  • ctrl-L adds a new blank line. It doesn't do what I wanted. But thanks for your post – Ozkan Mar 5 '14 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.