Clearing screen after boot and logout

How could I have the screen cleared after all the boot scripts are done like most Linux distributions, and just have the login prompt on the screen, and on logout too. Also, would all those random messages like SSH logins show up on the screen?
 
FWIK clearing the screen on logout depends on the shell used.
For example, using csh, you can # echo clear >> /etc/csh_logout (~/.logout for single user). For bash you can do the same but the file is ~/.bash_logout ...

For the messages on the console, you may want to edit /etc/syslog.conf after reading syslog.conf(5).
 
Consider the unwanted side effect: If there is a message followed by logout, you'll never get to read the message. I actually disabled clearing the screen on my Linux machines for just that reason. Hint: In /etc/systemd/system/getty@.service.d/noclear.conf, add TTYVTDisallocate=no.

Using the same logic, the best place to implement clearing the screen after logout may be in the configuration of getty: See man getty and man gettytab; a quick search didn't find anything that leaps out, but please read them more carefully.
 
I also want to clear the screen after logging out when I am logged into one of the virtual consoles.

Is there a system-wide .logout for /bin/sh (root)?
For sh(1) and other shells reading user or system wide "profile" the configuration below clears the screen after logout.

/etc/profile
Code:
# System-wide .profile file for sh(1).

# Clear screen after logout
trap "$HOME/.logout" 0

I can't remember ever seeing a post-logout message on virtual consoles (not counting syslog messages on first system console /dev/console, tty0). Is this even intended or provided on FreeBSD?
 
Also, would all those random messages like SSH logins show up on the screen?
With regards to "random" messages, check /etc/syslog.conf, specifically the first line:
Code:
*.err;kern.warning;auth.notice;mail.crit                /dev/console
You can disable this if you want.
 
Back
Top