Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

thanks:)

share|improve this question
add comment

4 Answers

up vote 94 down vote accepted

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.


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.

share|improve this answer
    
nice. i guess I'll never use clear again :) –  Stann Feb 6 '11 at 21:58
    
I wish I'd heard about this ages ago! Thanks :D –  Adrian Petrescu Feb 7 '11 at 2:33
3  
Probably doesn't matter for most users, but the behavior of reset is dependent on the terminal. –  cthom06 Feb 7 '11 at 13:44
    
Personally I don't mind that something is left "up" along the scroller when I hit ^L. I don't see it (that's what I want!), I don't feel it, and if suddenly I would need to restore what was there — no problem. reset in contrast is much harder tool — I'll use it when something went wrong with the terminal — like, when weird escape sequences accidentally ruined the display altogether. –  ulidtko Feb 7 '11 at 13:56
4  
@ulidtko: it does matter when you run consecutive sessions of programs with tons of output. If you scroll back it's easy to get confused about which execution printed something. I know perfectly well that more sophisticated solutions could be used in these cases, but nonetheless it's a scenario that comes about pretty often in quick & dirty debugging sessions. –  UncleZeiv Feb 9 '11 at 12:49
show 2 more comments

You can also assign a shortcut in gnome-terminal by going to Edit → Keyboard Shortcuts. I use Ctrl+Alt+C.

reset and clear shortcut

share|improve this answer
    
+1. I always have the Menubar hidden; so even after years and years of using gnome, I never thought to look for this. Thanks :-) –  Stefano Palazzo Feb 9 '11 at 12:53
add comment

run this command:

reset

This has the same effect as launching a new terminal.

share|improve this answer
1  
When using putty, after running reset, I can still scroll up and see previous stuff. Is this an issue with PuTTY rather than reset? –  Svish Feb 7 '11 at 14:43
    
@svish -- that's just a putty implementation issue or decision. –  belacqua Feb 8 '11 at 22:52
    
@jgbelacqua, Deal :) –  Svish Feb 9 '11 at 9:27
add comment

Well it really depends, if you are using Konsole for instance even reset doesn't prevent you to scroll past the first line. In that case you have to use some feature of the particular terminal you are using. For Konsole, it's Edit > Clear History.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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