238 lines
5.2 KiB
HTML
238 lines
5.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of clear</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>clear</H1>
|
|
Section: User Commands (1)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
<B>clear</B> - clear the terminal screen
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>clear</B> [<B>-T</B><I>type</I>] [<B>-V</B>] [<B>-x</B>]
|
|
<BR>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>clear</B> clears your screen if this is possible,
|
|
including its scrollback buffer
|
|
(if the extended ``E3'' capability is defined).
|
|
<B>clear</B> looks in the environment for the terminal type
|
|
given by the environment variable <B>TERM</B>,
|
|
and then in the
|
|
<B>terminfo</B> database to determine how to clear the screen.
|
|
<P>
|
|
|
|
<B>clear</B> writes to the standard output.
|
|
You can redirect the standard output to a file (which prevents
|
|
<B>clear</B> from actually clearing the screen),
|
|
and later <B>cat</B> the file to the screen, clearing it at that point.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<P>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-T </B><I>type</I>
|
|
|
|
<DD>
|
|
indicates the <I>type</I> of terminal.
|
|
Normally this option is
|
|
unnecessary, because the default is taken from the environment
|
|
variable <B>TERM</B>.
|
|
If <B>-T</B> is specified, then the shell
|
|
variables <B>LINES</B> and <B>COLUMNS</B> will also be ignored.
|
|
<DT id="2"><B>-V</B>
|
|
|
|
<DD>
|
|
reports the version of ncurses which was used in this program, and exits.
|
|
The options are as follows:
|
|
<DT id="3"><B>-x</B>
|
|
|
|
<DD>
|
|
do not attempt to clear the terminal's scrollback buffer
|
|
using the extended ``E3'' capability.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>HISTORY</H2>
|
|
|
|
A <B>clear</B> command appeared in 2.79BSD dated February 24, 1979.
|
|
Later that was provided in Unix 8th edition (1985).
|
|
<P>
|
|
|
|
AT&T adapted a different BSD program (<B>tset</B>) to make
|
|
a new command (<B>tput</B>),
|
|
and used this to replace the <B>clear</B> command with a shell script
|
|
which calls <B>tput clear</B>, e.g.,
|
|
|
|
<BR> .sp
|
|
|
|
<BR> .in +4
|
|
|
|
<PRE>
|
|
/usr/bin/tput ${1:+-T$1} clear 2> /dev/null
|
|
exit
|
|
|
|
</PRE>
|
|
|
|
|
|
<BR> .in -4
|
|
|
|
|
|
<P>
|
|
|
|
In 1989, when Keith Bostic revised the BSD <B>tput</B> command
|
|
to make it similar to the AT&T <B>tput</B>,
|
|
he added a shell script for the <B>clear</B> command:
|
|
|
|
<BR> .sp
|
|
|
|
<BR> .in +4
|
|
|
|
<PRE>
|
|
exec tput clear
|
|
|
|
</PRE>
|
|
|
|
|
|
<BR> .in -4
|
|
|
|
|
|
<P>
|
|
|
|
The remainder of the script in each case is a copyright notice.
|
|
<P>
|
|
|
|
The ncurses <B>clear</B> command began in 1995 by adapting the original
|
|
BSD <B>clear</B> command (with terminfo, of course).
|
|
<P>
|
|
|
|
The <B>E3</B> extension came later:
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
In June 1999, xterm provided an extension to the standard control
|
|
sequence for clearing the screen.
|
|
Rather than clearing just the visible part of the screen using
|
|
|
|
<BR> .sp
|
|
|
|
<BR> .in +4
|
|
|
|
<PRE>
|
|
printf '\033[2J'
|
|
|
|
</PRE>
|
|
|
|
|
|
<BR> .in -4
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="4"><DD>
|
|
one could clear the <I>scrollback</I> using
|
|
|
|
<BR> .sp
|
|
|
|
<BR> .in +4
|
|
|
|
<PRE>
|
|
printf '\033[<B>3</B>J'
|
|
|
|
</PRE>
|
|
|
|
|
|
<BR> .in -4
|
|
|
|
|
|
<DT id="5"><DD>
|
|
This is documented in <I>XTerm Control Sequences</I> as a feature originating
|
|
with xterm.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
A few other terminal developers adopted the feature, e.g., PuTTY in 2006.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
In April 2011, a Red Hat developer submitted a patch to the Linux
|
|
kernel, modifying its console driver to do the same thing.
|
|
The Linux change, part of the 3.0 release, did not mention xterm,
|
|
although it was cited in the Red Hat bug report (#683733)
|
|
which led to the change.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
Again, a few other terminal developers adopted the feature.
|
|
But the
|
|
next relevant step was a change to the <B>clear</B> program in 2013
|
|
to incorporate this extension.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
In 2013, the <B>E3</B> extension was overlooked in <B>tput</B> with
|
|
the ``clear'' parameter.
|
|
That was addressed in 2016 by reorganizing <B>tput</B> to share
|
|
its logic with <B>clear</B> and <B>tset</B>.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>PORTABILITY</H2>
|
|
|
|
Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7
|
|
(POSIX.1-2008) nor X/Open Curses Issue 7 documents tset or reset.
|
|
<P>
|
|
|
|
The latter documents <B>tput</B>, which could be used to replace this utility
|
|
either via a shell script or by an alias (such as a symbolic link) to
|
|
run <B>tput</B> as <B>clear</B>.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+tput">tput</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+terminfo">terminfo</A></B>(5)
|
|
<P>
|
|
|
|
This describes <B>ncurses</B>
|
|
version 6.2 (patch 20200212).
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="6"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="7"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="8"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="9"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="10"><A HREF="#lbAF">HISTORY</A><DD>
|
|
<DT id="11"><A HREF="#lbAG">PORTABILITY</A><DD>
|
|
<DT id="12"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:09 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|