gclear(1) | User commands | gclear(1) |
gclear - clear the terminal screen
gclear [-x] [-T terminal-type]
gclear -V
gclear clears your terminal's screen and its scrollback buffer, if any. gclear retrieves the terminal type from the environment variable TERM, then consults the terminfo terminal capability database entry for that type to determine how to perform these actions.
The capabilities to clear the screen and scrollback buffer are named “clear” and “E3”, respectively. The latter is a user-defined capability, applying an extension mechanism introduced in ncurses 5.0 (1999).
gclear recognizes the following options.
Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7 (POSIX.1-2008) nor X/Open Curses Issue 7 documents gclear.
The latter documents tput, which could be used to replace this utility either via a shell script or by an alias (such as a symbolic link) to run gtput as gclear.
A clear command using the termcap database and library appeared in 2BSD (1979). Eighth Edition Unix (1985) later included it.
The commercial Unix arm of AT&T adapted a different BSD program (tset) to make a new command, tput, and replaced the clear program with a shell script that called “tput clear”.
/usr/bin/tput ${1:+-T$1} clear 2> /dev/null exit
In 1989, when Keith Bostic revised the BSD tput command to make it similar to AT&T's tput, he added a clear shell script as well.
exec tput clear
The remainder of the script in each case is a copyright notice.
In 1995, ncurses's clear began by adapting BSD's original clear command to use terminfo. The E3 extension came later.
printf '\033[2J'
printf '\033[3J'
2024-03-16 | ncurses 6.5 |