On my debian system, /usr/bin/clear
and /usr/bin/tput
are part of the ncurses-bin
package, and /usr/bin/clear_console
is part of the bash
package.
Why should the default .bash_logout
assume that the ncurses-bin
package is installed?
Also, if run from a Linux virtual terminal (not from a serial or pseudo tty) clear_console(1)
will also clear the scrollback buffer (in addition to sending the clear
/cl
terminfo escape).
It will do that by switching back and forth to another vt [1], and by sending the \e[3J
"flush scrollback" escape.
On newer systems, clear
and tput clear
will also send that \e[3J
escape (but not on many distros still in use, eg. Centos 7 or Debian 9 -- on the latter, the TERM
environment variable should be set to linux3.0
, which is not the default).
See the source of clear_console
here.
[1] which may be defeated by the vgacon.scrollback_persistent=1
boot param, if your kernel was compiled with the VGACON_SOFT_SCROLLBACK
option ("Enable Scrollback Buffer in System RAM").