console-clear, clear_console — clear a user-space virtual terminal


console-clear [--7bit] [--8bit]

clear_console [--7bit] [--8bit]


console-clear emits control sequences to its standard output that instruct a compatible terminal emulator to clear its entire output, both display and any off-screen buffers.

It does not employ operating system and device specific ioctl(2) calls, and so can be used remotely and with terminal emulators other than the ones built into operating system kernels.

Rather, it emits simple terminal control sequences, by chaining to foreground(1) in order to run console-control-sequence(1) twice, once with --clear all and once with --clear scrollback .

It passes the the --7bit and --8bit command-line options straight through to console-control-sequence.


For compatibility with the Bourne Again shell toolset, this command is also available as clear_console, whose functionality it duplicates. Unlike the Bourne Again shell toolset's clear_console command, this command is not specific to kernel virtual terminal character devices, does not involve switching kernel virtual terminals (a process that can go wrong if an X server happens to be using the "other" virtual terminal), and respects redirection of its standard output.

Note that the use case for clear_console is clearing the whole display buffer on user logoff, which console-terminal-emulator(1) does anyway, as standard.

This command makes no attempt to behave differently if its output is not to a terminal, since one might want to use it to generate the control sequences to send to a file, a pipe, or a non-terminal device.

For compatibility of the actual control sequences emitted with various terminals and terminal emulators, see the console-control-sequence(1) manual.


Jonathan de Boyne Pollard