Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question
Press Ctrl+L twice and you get blank! – Pandya Jul 30 '14 at 12:19

11 Answers 11

up vote 230 down vote accepted

Yes, the command you're looking for is


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 @Wallacoloo 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.

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
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
@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

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
“Reset” do nothing for me, and “Reset and Clear” clear everything but does not re‑display the prompt. None of these menu entries behave like the “reset” command from a terminal. – Hibou57 Jul 9 '14 at 8:50
As @Hibou57 said, my keyboard shortcut for "Reset" doesn't seem to do anything. Is this functionality broken in 14.04? – Michael Martin-Smucker Aug 23 '14 at 20:37
“Is this functionality broken in 14.04?”: this is the same with 12.04. – Hibou57 Aug 24 '14 at 2:53

I was looking for this for a while and I found some genius that posted this:

clear && printf '\e[3J'

Clears the whole screen buffer, very clean. Works on OSX and believe it works fine on most *nix terminals.

I hope someone finds that as useful as I did :)

share|improve this answer
Hmm, works in xterm, Konsole and Linux VT, but doesn't in gnome-terminal... – Ruslan Jun 24 '14 at 13:02
Best answer. Even purges tmux history (as in Ctrl+b PgUp; reset fails to do so; tested in rxvt-unicode/urxvt; tmux-specific alternative: clear && tmux clearhist). – user569825 Jul 28 '14 at 9:52
Thanks, works great on my Mac - I really missed a real Bash-style reset. – JohnnyCoder Feb 17 '15 at 21:22
Thanks, that's super useful! What does printf '\e[3J' mean? How does it clean the buffer? – Filip Spiridonov Jul 24 '15 at 17:03

run this command:


This has the same effect as launching a new terminal.

share|improve this answer
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

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

Alternatively to reset, you can do echo -e "\033c", or have in your .bashrc, something like alias cls="echo -ne '\033c'"

The UNIX/Linux StackExchange, has a thread on this: How to clear terminal completely? (, as well as SuperUser : Clear terminal using keyboard shortcut (

share|improve this answer

Another alternative to the @Hibou57 answer:

# The Octal Way
alias clear="echo -e '\033c\c'"


# The Hex Way
alias clear="echo -e '\x1b\c'"

Basically this will have exactly the same effect, it will print the ^[ character (which clear your terminal) and does not output the trailing new line.

share|improve this answer

Cross posting my answer from stackoverflow.

Use the following command to do a clear screen instead of merely adding new lines ...

printf "\033c"

yes that's a 'printf' on the bash prompt.

You will probably want to define an alias though...

alias cls='printf "\033c"'


\033 == \x1B == 27 == ESC

So this becomes <ESC>c which is the VT100 escape code for resetting the terminal. Here is some more information on terminal escape codes.


Here are a few other ways of doing it...

printf "\ec" #\e is ESC in bash
echo -en "\ec" #thanks @Jonathon Reinhart.
# -e    Enable interpretation of of backslash escapes
# -n    Do not output a new line


The above does not work on the KDE console (called Konsole) but there is hope! Use the following sequence of commands to clear the screen and the scroll-back buffer...

clear && echo -en "\e[3J"

Or perhaps use the following alias on KDE...

alias cls='clear && echo -en "\e[3J"'

I got the scroll-back clearing command from here.

share|improve this answer

My favorite is printf "\ec". This can also be printf "\033c" or printf "\x1bc". That is an ansi escape sequence that miraculously clears the screen and buffer for the terminal output (for most standard terminals I have worked in it seems - I know it works in such as gnome-terminal, terminator, xterm, etc. on Ubuntu-like Linuxes)

I know this works in Linux Mint and Ubuntu 14.04, so I don't know why people are appending and prepedning things like clear && echo -ne "\033c. printf "\ec" has always worked for me.

Additionally, in my .bashrc I have a binding like this:

bind -x '"\C-t": printf "\ec"';

Now I press ctrlt all the time.

share|improve this answer

I have found the following to be quite successful with Kubuntu:

alias clc="echo -en '\033c\033[3J'"

You can use cls to keep with the Windows tradition, use the Matlab version clc, or one of your own. Good luck!

share|improve this answer

If you're using yakuake, like I do, try ctrl + shift + k.


share|improve this answer

protected by heemayl Dec 21 '15 at 9:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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