Ubuntu – How to really clear the terminal

command linexterm

I can issue the clear command or press Ctrl + L to clear the current Ubuntu terminal, but this just shifts previous output upwards and if you use mouse scroll or PgUP and PgDown keys it's hard to distinguish where the output of previous command ends and output of current command begins.

Is there a way to really clear the terminal so I won't see previous command results?

Best Answer

Yes, the command you're looking for is

reset

In contrast to clear, or Ctrl+L, reset will actually completely re-initialise the terminal, instead of just clearing the screen. However, it won't re-instantiate the shell (bash). That means that bash's state is the same as before, just as if you were merely clearing the screen.

As @Ponkadoodle mentions in the comments, this command should do the same thing more quickly:

tput reset

From the other answers:

  • You can set a Keyboard Shortcut to reset the terminal, as explained by towolf.

  • If you're running Kubuntu, and your terminal is Konsole, you need to go to Edit → Clear history, since reset doesn't work the same way there, as UncleZeiv notes.

Related Question