Clear screen on logout

This guide explains how to automatically clear the screen on logout.

Clear screen on logout
To have your terminal cleared, add to your  script:

If you want this to happen automatically when you add a new user, do the same for the :

(Gentoo FAQ # clear)

If you want this to happen automatically for all bash shells, regardless of user edit and change  to

Clearing the scrollback
The Linux console uses video memory for hardware scrolling. A side-effect of this is the availability of scrollback using SHIFT+PageUp etc. Unfortunately, issuing a "clear" command does not clear this scrollback, so simply logging out after issuing the "clear" command will not completely prevent people from seeing what you have been doing.

1. Use the "no-scroll" boot parameter to turn off hardware scrolling altogether. Scrolling will be slower if you do this.

2. Flush the screen with a lot of random chars from /dev/urandom before logging out.

After this, the whole scrollback buffer is overwritten with random chars.

3. Switch to a different virtual console after logging out. The scrollback buffer is not saved to kernel memory, so will not be restored if someone switches back to the console you were using.

4. Change the console font to lat1-08 and back to its original. The following shell script should automate this task:

script.sh