]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/clear.1
ncurses 6.0 - patch 20161224
[ncurses.git] / man / clear.1
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2013,2016 Free Software Foundation, Inc.              *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: clear.1,v 1.14 2016/11/19 21:30:46 tom Exp $
30 .TH @CLEAR@ 1 ""
31 .\" these would be fallbacks for DS/DE,
32 .\" but groff changed the meaning of the macros.
33 .de NS
34 .sp .5
35 .in +4
36 .nf
37 .ft C                   \" Courier
38 ..
39 .de NE
40 .fi
41 .ft R
42 .in -4
43 ..
44 .ie \n(.g .ds `` \(lq
45 .el       .ds `` ``
46 .ie \n(.g .ds '' \(rq
47 .el       .ds '' ''
48 .de bP
49 .IP \(bu 4
50 ..
51 .ds n 5
52 .SH NAME
53 \fB@CLEAR@\fR \- clear the terminal screen
54 .SH SYNOPSIS
55 \fB@CLEAR@\fR
56 .br
57 .SH DESCRIPTION
58 \fB@CLEAR@\fR clears your screen if this is possible,
59 including its scrollback buffer (if the extended \*(``E3\*('' capability is defined).
60 \fB@CLEAR@\fR looks in the environment for the terminal type and then in the
61 \fBterminfo\fR database to determine how to clear the screen.
62 .PP
63 \fB@CLEAR@\fR ignores any command-line parameters that may be present.
64 .SH HISTORY
65 A \fBclear\fP command appeared in 2.79BSD dated February 24, 1979.
66 Later that was provided in Unix 8th edition (1985).
67 .PP
68 AT&T adapted a different BSD program (\fBtset\fP) to make
69 a new command (\fBtput\fP),
70 and used this to replace the \fBclear\fP command with a shell script
71 which calls \fBtput clear\fP, e.g.,
72 .NS
73 /usr/bin/tput ${1:+-T$1} clear 2> /dev/null
74 exit
75 .NE
76 .PP
77 In 1989, when Keith Bostic revised the BSD \fBtput\fP command
78 to make it similar to the AT&T \fBtput\fP,
79 he added a shell script for the \fBclear\fP command:
80 .NS
81 exec tput clear
82 .NE
83 .PP
84 The remainder of the script in each case is a copyright notice.
85 .PP
86 The ncurses \fBclear\fP command began in 1995 by adapting the original
87 BSD \fBclear\fP command (with terminfo, of course).
88 .PP
89 The \fBE3\fP extension came later:
90 .bP
91 In June 1999, xterm provided an extension to the standard control
92 sequence for clearing the screen.
93 Rather than clearing just the visible part of the screen using
94 .NS
95 printf '\\033[2J'
96 .NE
97 .IP
98 one could clear the \fIscrollback\fP using
99 .NS
100 printf '\\033[\fB3\fPJ'
101 .NE
102 .IP
103 This is documented in \fIXTerm Control Sequences\fP as a feature originating
104 with xterm.
105 .bP
106 A few other terminal developers adopted the feature, e.g., PuTTY in 2006.
107 .bP
108 In April 2011, a Red Hat developer submitted a patch to the Linux
109 kernel, modifying its console driver to do the same thing.
110 The Linux change, part of the 3.0 release, did not mention xterm,
111 although it was cited in the Red Hat bug report (#683733)
112 which led to the change.
113 .bP
114 Again, a few other terminal developers adopted the feature.  But the
115 next relevant step was a change to the \fBclear\fP program in 2013
116 to incorporate this extension.
117 .bP
118 In 2013, the \fBE3\fP extension was overlooked in \fB@TPUT@\fP with
119 the \*(``clear\*('' parameter.
120 That was addressed in 2016 by reorganizing \fB@TPUT@\fP to share
121 its logic with \fB@CLEAR@\fP and \fB@TSET@\fP.
122 .SH PORTABILITY
123 Neither IEEE Std 1003.1/The Open  Group  Base  Specifications  Issue  7
124 (POSIX.1-2008) nor X/Open Curses Issue 7 documents @TSET@ or @RESET@.
125 .PP
126 The latter documents \fBtput\fP, which could be used to replace this utility
127 either via a shell script or by an alias (such as a symbolic link) to
128 run \fB@TPUT@\fP as \fB@CLEAR@\fP.
129 .SH SEE ALSO
130 \fB@TPUT@\fR(1), \fBterminfo\fR(\*n)
131 .PP
132 This describes \fBncurses\fR
133 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).