From: Maxwell Lol on
John Taylor <john(a)jt.response.invalid> writes:

> On Wed, 27 Jan 2010 11:52:11 +0000, Peter Hanke wrote:
>
>> Assume I opened a terminal window and entered a lot of commands.
>>
>> Is there a way to clear all previous input and output lines on this
>> terminal window? Of cause without closing and re-opening the Terminal
>> window. Afterwards the terminal should look like as if the terminal had
>> been just opened. All history lines are deleted.
>>
>> I guess there is a command like
>>
>> clr
>>
>> or similar to achieve this
>>
>
> How about:
>
> clear

That does not clear the history file. You could set the history file
count to zero, and then reset it to the proper value.

You could, from the shell, type

$SHELL;clear

And when done, hit control-d, which will erase history and clear the
screen.

I usually open a new tab, and when done, I close the tab.



From: Chris F.A. Johnson on
On 2010-01-27, Peter Hanke wrote:
> Assume I opened a terminal window and entered a lot of commands.
>
> Is there a way to clear all previous input and output lines on this terminal window?
> Of cause without closing and re-opening the Terminal window.
> Afterwards the terminal should look like as if the terminal had been just opened.
> All history lines are deleted.
>
> I guess there is a command like
>
> clr
>
> or similar to achieve this

To clear the screen in bash, press ^L.

If you want to clear the terminal's buffer, that depends on
whether your terminal has that capability.

--
Chris F.A. Johnson, author | <http://cfajohnson.com>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
From: Mike on
On Jan 27, 11:52 am, peter...(a)andres.net (Peter Hanke) wrote:
> Assume I opened a terminal window and entered a lot of commands.
>
> Is there a way to clear all previous input and output lines on this terminal window?
> Of cause without closing and re-opening the Terminal window.
> Afterwards the terminal should look like as if the terminal had been just opened.
> All history lines are deleted.
>
> I guess there is a command like
>
> clr
>
> or similar to achieve this
>
> Peter

Did you try "clear"? It works for me.

For clearing history, try

# history -c

I found that with a google search.

-Mike

From: unruh on
On 2010-01-30, Mike <michael.h.williamson(a)gmail.com> wrote:
> On Jan 27, 11:52?am, peter...(a)andres.net (Peter Hanke) wrote:
>> Assume I opened a terminal window and entered a lot of commands.
>>
>> Is there a way to clear all previous input and output lines on this terminal window?
>> Of cause without closing and re-opening the Terminal window.
>> Afterwards the terminal should look like as if the terminal had been just opened.
>> All history lines are deleted.
>>
>> I guess there is a command like
>>
>> clr
>>
>> or similar to achieve this
>>
>> Peter
>
> Did you try "clear"? It works for me.
>
> For clearing history, try
>
> # history -c
>
> I found that with a google search.
>
> -Mike
>

As he has said, clear just clears the screen. It does not clear the
history.
history -c is supposed to clear the history, in bash.
So you want
clear;history -c
you can make that an alias

alias clrhist='clear;history -c'
and put it into .bashrc
From: Kevin Collins on
On 2010-01-27, Peter Hanke <peter_ha(a)andres.net> wrote:
> Assume I opened a terminal window and entered a lot of commands.
>
> Is there a way to clear all previous input and output lines on this terminal window?
> Of cause without closing and re-opening the Terminal window.
> Afterwards the terminal should look like as if the terminal had been just opened.
> All history lines are deleted.
>
> I guess there is a command like
>
> clr
>
> or similar to achieve this

You are looking for the 'clear' command...

Kevin