1

The linux terminal has a handy command named "clear" that removes all previous output. Unfortunately, when I run this command and then compile a rather large project with gcc, all previous output magically reappears in the terminal. This makes it hard to find errors and things.

Is there some way to permanently clear the terminal in Ubuntu?

Edit: I think it's bash - it's whatever the default for Ubuntu 10.04 is. Anyway, reset worked.

Jake
  • 150
  • what terminal are you using? (bash, csh, etc.)? – Nate Koppenhaver Dec 09 '11 at 03:21
  • 1
    @NateKoppenhaver: terminal != shell ... the terminal is the program which displays the output of the shell and forwards the input of the user to the shell. terminal is something like xterm, urxvt, konsole, gnome-terminal etc... – akira Dec 09 '11 at 06:43
  • @Jake: since the terminal holds the rendered text of the shell it is important to know which terminal you use... – akira Dec 09 '11 at 06:44
  • @Jake: On your edit: As akira said, bash is not a terminal. It's a shell. – u1686_grawity Dec 09 '11 at 07:59

2 Answers2

7

Assuming are you using Bash.

Clear command, just "move the page down". Clearing the current terminal view, but history is kept.

You should use the reset to permanently clear the terminal.

0

Eventually I found a better alternative to this. I use the following command:

alias clear=`echo -en "\ec"'

This removes everything from the current terminal window, similar to the default clear command, but the content is actually purged rather than just hidden a page up.

The reset command is probably more portable but it's also slower and does a lot more than just removing the visible text from the window.

Here is some further explanation:

What commands can I use to reset and clear my terminal?

Jake
  • 150