From: The Natural Philosopher on
GangGreene wrote:
> John Taylor wrote:
>
>> 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
>>
>> ?
>
>
> Doesn't work :(
>
> Every time I use it the screen goes blank!
>
in which case, its worked hasn't it?
From: John Gordon on
In <4b6028ea$0$6582$9b4e6d93(a)newsspool3.arcor-online.net> peter_ha(a)andres.net (Peter Hanke) writes:

> I guess there is a command like

> clr

There's a command called "clear" that will erase the displayed contents
of the window, but it will not remove your saved history of commands.

--
John Gordon A is for Amy, who fell down the stairs
gordon(a)panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

From: jellybean stonerfish on
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.

When you say history lines, do you mean visible, or the command history
of your shell? We will assume you mean command history.

>
> I guess there is a command like
>
> clr
>
> or similar to achieve this
>
> Peter

"reset" or "clear" will both clear your terminal. "reset" does a bit
more, such as set it back the way it was when you started, in case
some control characters have changed something. For example if you
run 'cat somefile.jpg", somefile.jpg is not plain text so will probably
mess up your terminal in some way.

If you are using "bash", "history -c" will clear the your command history,
and "history -r" will read it again from the history file. So if you do
"history -c; history -r;" your history will be back to what it was when
you started your terminal session.

Combining all three will pretty much put your teminal back to the way it
was when you opened it. This will not clear any variables you may have
set.

"history -c; history -r; reset;"

If this is something you do frequently, you may want to append a line to
your .bashrc file,

alias histscreenclear="history -c; history -r; reset;"

to condense them into one command.

stonerfish


From: AZ Nomad on
On Wed, 27 Jan 2010 15:31:23 +0000 (UTC), John Gordon <gordon(a)panix.com> wrote:
>In <4b6028ea$0$6582$9b4e6d93(a)newsspool3.arcor-online.net> peter_ha(a)andres.net (Peter Hanke) writes:

>> I guess there is a command like

>> clr

>There's a command called "clear" that will erase the displayed contents
>of the window, but it will not remove your saved history of commands.

rtfm for your shell.
typically it is in .history. 'rm .history' should wipe it.
From: Doug McIntyre on
peter_ha(a)andres.net (Peter Hanke) writes:
>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.


It depends heavily on the shell you are using. Since you posted this
to a unix group, with a followup to a linux group, I'm going to assume
you are a bash user.

You can erase all the history entries in memory by 'export HISTSIZE=0'
You can have bash not save history out to its .bash_history with
'unset HISTFILE'.

More info in the 'man bash' in the HISTORY section.