From: Aragorn on
On Wednesday 27 January 2010 12:52 in comp.os.linux.misc, somebody
identifying as 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

"clear" is the command to do it, but most terminals also respect the
[Ctrl+L] keypress to clear the screen. Mind you, this will not clear
your ".bash_history". You need...

history -c

.... for that.

--
*Aragorn*
(registered GNU/Linux user #223157)
From: Marten Kemp on
John Gordon 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.

Yeah, that fits into the "terse to the point of incomprehensibility"
command scheme of *nix-ish operating systems. <grin>

--
-- Marten Kemp (Fix ISP to reply)
You can't help being ignorant 'cause there's always
something you don't know; what you can't be is stupid.
From: Backpacker on
Aragorn wrote:

> On Wednesday 27 January 2010 12:52 in comp.os.linux.misc, somebody
> identifying as Peter Hanke wrote...
>>
>> Is there a way to clear all previous input and output lines on this
>> terminal window?
>
> "clear" is the command to do it, but most terminals also respect the
> [Ctrl+L] keypress to clear the screen.

A few people have mentioned the 'clear' command. While this command, and the
Ctrl+L keypress, appear to clear the terminal window, holding down the Shift
key and pressing the up arrow or PageUp key shows that the buffer hasn't
been cleared - all of the previous lines are still held in the buffer and
will reappear. Even a 'reset' won't clear them. And nor will 'tput clear'.

I mention all this as a potential security issue. If you think that 'clear'
or Ctrl+L has hidden what you were doing in the terminal, it hasn't.

--
Backpacker

From: unruh on
On 2010-01-27, Backpacker <Backpacker(a)rekcapkcaB.invalid.org> wrote:
> Aragorn wrote:
>
>> On Wednesday 27 January 2010 12:52 in comp.os.linux.misc, somebody
>> identifying as Peter Hanke wrote...
>>>
>>> Is there a way to clear all previous input and output lines on this
>>> terminal window?
>>
>> "clear" is the command to do it, but most terminals also respect the
>> [Ctrl+L] keypress to clear the screen.
>
> A few people have mentioned the 'clear' command. While this command, and the
> Ctrl+L keypress, appear to clear the terminal window, holding down the Shift
> key and pressing the up arrow or PageUp key shows that the buffer hasn't
> been cleared - all of the previous lines are still held in the buffer and
> will reappear. Even a 'reset' won't clear them. And nor will 'tput clear'.
>
> I mention all this as a potential security issue. If you think that 'clear'
> or Ctrl+L has hidden what you were doing in the terminal, it hasn't.
>

It has hidden what you did on the window. Hide does not mean destroy.
Anyway,
rm -f ~/.bash_history
and close the window
should do at least part of it.


From: Allodoxaphobia on
On Wed, 27 Jan 2010 16:19:08 -0500, Marten Kemp wrote:
> John Gordon wrote:
>> 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.
>
> Yeah, that fits into the "terse to the point of incomprehensibility"
> command scheme of *nix-ish operating systems. <grin>

heh...

I still have a hard time _forgetting_ the "terse" OS/2 `cls` command,
and I continue to use it even 9+ years after moving on to linux.

I have `cls` set thus: alias cls='clear && echo -e "`pwd`\n"'

I suppose a feller could do:

alias cls='clear && history -c'

for a possible solution to the OP.

Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2
* Killfiling google & XXXXbanter.com: jonz.net/ng.htm