Greg Wooledge:
The man page for |clear_console|(1) is a little unclear to me, and a
little bit disturbing. I cannot figure out what "changes the
foreground virtual terminal to another terminal" is supposed to mean,
but between that and the reference to |chvt|(1) under SEE ALSO, it
seems like someone might want to investigate that more closely.
I already did, years ago. It is why I years ago wrote and published a
replacement |clear_console
<https://jdebp.eu/Softwares/nosh/guide/commands/clear_console.xml>| that
just uses the control sequences to clear the scrollback buffer, gaining
the benefit of working remotely, with GUI terminal emulators, and with
PuTTY along the way. It has been in the nosh toolset since version 1.19
in 2015. The original |clear_console| from the Bourne Again shell
package is, in contrast, using the side-effects of switching between
KVTs as a way of clearing the scrollback buffer. It switches them back
and forth very rapidly.
I explained this in this very mailing list three years ago
<https://lists.debian.org/debian-user/2015/08/msg00958.html>. I also
explained it in the 1.19 announcement
<https://lists.debian.org/debian-user/2015/08/msg00951.html>, also on
this very mailing list, pointing to a whole bunch of Debian bugs. I also
explained it on Unix and Linux StackExchange
<https://unix.stackexchange.com/a/451150/5132>. It's even explained in
the manual. (-: