PDA

View Full Version : HOWTO: Clear console screen after logout


vermaden
05-05-2008, 12:30 PM
I have tried to put clear at shells logout scripts: /etc/{zlogout,csh.logout} etc, also changing /etc/gettytab from:

P|Pc|Pc console:\
:ht:np:sp#115200:

to:

P|Pc|Pc console:\
:ht:np:sp#115200:\
:cl=\E[H\E[2J:

does not prevent user from hitting Scroll Lock key and scrolling terminal history with Page {Up,Down}.

At this moment the only trully working sollution to this I have found is to put:

vidcontrol -C && clear

to all logout scripts of shells.

REPLIES:

vidcontrol -C && clear does this very well, but like I said I am looking for some PURE/PROPER sollution for this.

I don't think there's any other solution but ofcourse you could modify the getty source code to empty the sc scroll back buffer every time its run and recompile it :)

Cheers!

Thank You for another sollution, but I think that I will stay with vidcontrol -C && clear for one reason: why touch two files while I can touch only one. ;)

Regards

EDIT0: I think that I will use Your method because sh and ksh shells does not support any *logout files.

EDIT1: sollution to not use /etc/gettytab:
sh and ksh both use /etc/profile as a main startup file but as I mentioned before they does not support *logout files, the sollution is to put this command into /etc/profile:
trap "vidcontrol -C && clear" 0

so vidcontrol -C && clear will be executed at logout.