clear(1)
โจ clear(1) โจ
okay bestie, listen up โ this is a <strong>user command</strong>, and it's literally the "make it all go away" button for your terminal ๐
NAME ๐
clear โ wipe your terminal screen clean, no cap
SYNOPSIS ๐ฆ
clear [-x] [-T terminal-type]
clear -V
DESCRIPTION ๐
clear does exactly what it says on the tin: it <strong>clears your terminal's screen and its scrollback buffer</strong>, if there is one. Gone. Poof. โจ
So how does it know how to do that? Iconic behavior honestly. It grabs the terminal type from the environment variable TERM, then goes and consults the terminfo terminal capability database entry for that type to figure out how to pull off these actions. She's not guessing, she's doing research. ๐
The capabilities for clearing the screen and the scrollback buffer are named clear and E3, respectively. And bestie, that E3 one? It's a user-defined capability, applying an extension mechanism that got introduced in ncurses 5.0 (1999). Vintage but make it fashion. ๐
OPTIONS ๐ธ
clear recognizes the following options:
-Ttype โ produces instructions suitable for the terminal type. Normally this option is unnecessary, because the terminal type is inferred from the environment variableTERM. But if you do specify it,clearalso ignores the environment variablesLINESandCOLUMNS. She said "I don't need your extra hints, I have my own." ๐-Vโ reports the version ofncursesassociated with this program and exits with a successful status. Version check queen. ๐-xโ preventsclearfrom attempting to clear the scrollback buffer. Just the visible screen, thanks. ๐
PORTABILITY ๐
Neither <strong>IEEE Std 1003.1/The Open Group Base Specifications Issue 7 (POSIX.1-2008)</strong> nor <strong>X/Open Curses Issue 7</strong> documents clear. So like... it's not in the group chat. It's the friend everyone knows but nobody officially invited. ๐ญ
That second one does document tput, though โ which could be used to replace this utility either via a shell script or by an alias (such as a symbolic link) to run tput as clear. Rebranding era. โจ
HISTORY โญ
A clear command using the termcap database and library appeared in <strong>2BSD (1979)</strong>. Then <strong>Eighth Edition Unix (1985)</strong> later included it. Old money, fr fr. ๐ฉ
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
Then 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. (Spoiler: it's the boring part, but it's there, and we respect it. ๐ซถ)
In 1995, ncurses's clear began by adapting BSD's original clear command to use terminfo. The E3 extension came later. A glow-up in stages, honestly. ๐ฆ
- In June 1999,
xtermprovided an extension to the standard control sequence for clearing the screen. Rather than clearing just the visible part of the screen using
printf '\033[2J'
one could clear the scrollback buffer as well by using
printf '\033[3J'
instead. "XTerm Control Sequences" documents this feature as originating with xterm. She invented the trend, everybody else copied. ๐
- A few other terminal emulators adopted it, such as PuTTY in 2006.
- In April 2011, a Red Hat developer submitted a patch to the Linux kernel, modifying its console driver to do the same thing. Documentation of this change, appearing in Linux 3.0, did not mention
xtermโ although that program was cited in the Red Hat bug report (#683733) motivating the feature. Not the credit going where it should. ๐ - Subsequently, more terminal developers adopted the feature. The next relevant step was to change the ncurses
clearprogram in 2013 to incorporate this extension. - In 2013, the
E3capability was not exercised bytput clear. That oversight was addressed in 2016 by reorganizingtputto share its logic withclearandtset. Growth. Maturity. Communication. ๐ฑ
SEE ALSO ๐
and that's the whole page, bestie ๐ this lil manual is from ncurses 6.6, dated 2025-04-05 โ so like, she's fresh but she's been through eras. go clear that screen. you got this. ๐โจ๐ฆ
๐ฆ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 ยท X11
- arch rolling: ncurses 6.6-2 ยท MIT-open-group
- fedora 44: ncurses 6.6-1.fc44 ยท MIT-open-group
- nixos 26.05: ncurses 6.6
- nixos 26.05: ncurses-abi5-compat 6.6
- nixpkgs unstable: ncurses 6.6
- nixpkgs unstable: ncurses-abi5-compat 6.6
- ubuntu resolute: ncurses-bin 6.6+20251231-1 ยท MIT/X11
- ubuntu stonking: ncurses-bin 6.6+20260608-2 ยท MIT/X11
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2016,2017 Free Software Foundation, Inc
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms