Discussion:
Clearing Screen on Logout?
(too old to reply)
Carlos Williams
2010-03-02 18:00:02 UTC
Permalink
I noticed that with Debian when I logout of my system, it doesn't
clear the screen to the login screen via bash only (non GUI). Normally
in RHEL, Arch, Ubuntu, and most other distributions when a user logs
out or exits from a shell, their history is not visible on the screen
but in Debian, it is. Is there any way to change this? How can I exit
a shell window in Debian and have it clear my scrolled up commands and
actions to a blank login screen?
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: http://lists.debian.org/***@mail.gmail.com
James Zuelow
2010-03-02 18:10:01 UTC
Permalink
-----Original Message-----
Sent: Tuesday, 02 March, 2010 09:00
Subject: Re: Clearing Screen on Logout?
On Tue, Mar 2, 2010 at 6:52 PM, Carlos Williams
Post by Carlos Williams
I noticed that with Debian when I logout of my system, it doesn't
clear the screen to the login screen via bash only (non GUI).
# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
however a simple "clear" should be enough
bye
Another way of doing that is:

mv /etc/issue /etc/issue.original
clear > /etc/issue
cat /etc/issue.original >> /etc/issue

Then the console will clear when /etc/issue is read.

Although I do not usually change my shell so while I think it is a bit more portable if you use something like csh, etc. I am not absolutely positive.

James
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: http://lists.debian.org/***@city-exchange07
Carlos Williams
2010-03-02 18:20:01 UTC
Permalink
I found a pretty global / easy resolution.

http://www.patoche.org/LTT/screen/00000004.html
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: http://lists.debian.org/***@mail.gmail.com
ludovico van
2010-03-02 18:10:01 UTC
Permalink
Post by Carlos Williams
I noticed that with Debian when I logout of my system, it doesn't
clear the screen to the login screen via bash only (non GUI).
i have this in $HOME/.bash_logout :
# ~/.bash_logout: executed by bash(1) when login shell exits.

# when leaving the console clear the screen to increase privacy

if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi

however a simple "clear" should be enough

bye
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: http://lists.debian.org/***@mail.gmail.com
Chris Jackson
2010-03-02 18:10:02 UTC
Permalink
I think having to type 'clear' before log out is crazy. Also if I have
1,000 users, thats a log of files to edit. Is there no global file
config that will achieve this?
/etc/bash.logout

--
Chris Jackson
Shadowcat Systems Ltd.
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: http://lists.debian.org/***@shadowcat.co.uk
Carlos Williams
2010-03-02 18:10:03 UTC
Permalink
# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy
if [ "$SHLVL" = 1 ]; then
   [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
however a simple "clear" should be enough
bye
I think having to type 'clear' before log out is crazy. Also if I have
1,000 users, thats a log of files to edit. Is there no global file
config that will achieve this?
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: http://lists.debian.org/***@mail.gmail.com
ludovico van
2010-03-03 12:30:02 UTC
Permalink
# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy
if [ "$SHLVL" = 1 ]; then
   [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
however a simple "clear" should be enough
bye
I think having to type 'clear' before log out is crazy. Also if I have
1,000 users, thats a log of files to edit. Is there no global file
config that will achieve this?
I mean:
$ echo "clear" > ~/.bash_logout

or just copy the three lines above...

If you need it to be valid for all of your users, use the file
/etc/bash.logout (or is it /etc/bash.bash_logout ?? see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=546200)

bye
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: http://lists.debian.org/***@mail.gmail.com
Stephen Powell
2010-03-02 18:10:03 UTC
Permalink
Post by Carlos Williams
I noticed that with Debian when I logout of my system, it doesn't
clear the screen to the login screen via bash only (non GUI). Normally
in RHEL, Arch, Ubuntu, and most other distributions when a user logs
out or exits from a shell, their history is not visible on the screen
but in Debian, it is. Is there any way to change this? How can I exit
a shell window in Debian and have it clear my scrolled up commands and
actions to a blank login screen?
This is true only for the root user. If you logout from a virtual
terminal as a normal user, the screen clears. If you logout from
a virtual terminal as root, the screen does not clear. That's because
root does not have the standard .bash_logout file. It's easy to fix.
Just copy it from your non-superuser self. For example, if your
normal user account is "carlos", then issue this command as root:

cp /home/carlos/.bash_logout ~

I can't remember if it takes effect on the logout from this session,
but it will for sure on logout after the next login.
--
To UNSUBSCRIBE, email to debian-user-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: http://lists.debian.org/***@md01.wow.synacor.com
Loading...