xref: /netbsd/distrib/utils/more/more.1 (revision bf9ec67e)
1.\"	$NetBSD: more.1,v 1.5 2002/01/15 02:31:04 wiz Exp $
2.\"
3.\" Copyright (c) 1988, 1990, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"	@(#)more.1	8.2 (Berkeley) 4/18/94
36.\"
37.Dd April 18, 1994
38.Dt MORE 1
39.Os
40.Sh NAME
41.Nm more
42.Nd file perusal filter for CRT viewing
43.Sh SYNOPSIS
44.Nm
45.Op Fl ceinus
46.Op Fl t Ar tag
47.Op Fl x Ar tabs
48.Op Fl / Ar pattern
49.Op Fl #
50.Op Ar
51.Sh DESCRIPTION
52The
53.Nm
54command is a filter for paging through text one screenful at a time.
55It uses
56.Xr termcap  3
57so it can run on a variety of terminals.
58There is even limited support for hardcopy terminals.
59(On a hardcopy terminal, lines which should be printed at the top
60of the screen are prefixed with an up-arrow).
61.Ar File
62may be a single dash (``-''), implying stdin.
63.Sh OPTIONS
64Command line options are described below.
65Options are also taken from the environment variable
66.Ev MORE
67(make sure to precede them with a dash (``-'')) but command
68line options will override them.
69.Bl -tag -width flag
70.It Fl c
71Normally,
72.Nm
73will repaint the screen by scrolling from the bottom of the screen.
74If the
75.Fl c
76option is set, when
77.Nm
78needs to change the entire display, it will paint from the top line down.
79.It Fl e
80Normally, if displaying a single file,
81.Nm
82exits as soon as it reaches end-of-file.  The
83.Fl e
84option tells more to
85exit if it reaches end-of-file twice without an intervening operation.
86If the file is shorter than a single screen
87.Nm
88will exit at end-of-file regardless.
89.It Fl i
90The
91.Fl i
92option causes searches to ignore case; that is,
93uppercase and lowercase are considered identical.
94.It Fl n
95The
96.Fl n
97flag suppresses line numbers.
98The default (to use line numbers) may cause
99.Nm
100to run more slowly in some cases, especially with a very large input file.
101Suppressing line numbers with the
102.Fl n
103flag will avoid this problem.
104Using line numbers means: the line number will be displayed in the
105.Cm =
106command, and the
107.Cm v
108command will pass the current line number to the editor.
109.It Fl s
110The
111.Fl s
112option causes
113consecutive blank lines to be squeezed into a single blank line.
114.It Fl t
115The
116.Fl t
117option, followed immediately by a tag, will edit the file
118containing that tag.  For more information, see the
119.Xr ctags  1
120command.
121.It Fl u
122By default,
123.Nm
124treats backspaces and
125.Dv CR-LF
126sequences specially.  Backspaces which appear
127adjacent to an underscore character are displayed as underlined text.
128Backspaces which appear between two identical characters are displayed
129as emboldened text.
130.Dv CR-LF
131sequences are compressed to a single linefeed
132character.  The
133.Fl u
134option causes backspaces to always be displayed as
135control characters, i.e. as the two character sequence ``^H'', and
136.Dv CR-LF
137to be left alone.
138.It Fl x
139The
140.Fl x
141option sets tab stops every
142.Ar N
143positions. The default for
144.Ar N
145is 8.
146.It Fl /
147The
148.Fl /
149option specifies a string that will be searched for before
150each file is displayed.
151.El
152.Sh COMMANDS
153Interactive commands for
154.Nm
155are based on
156.Xr vi  1  .
157Some commands may be preceded by a decimal number, called N in the
158descriptions below.
159In the following descriptions, ^X means control-X.
160.Pp
161.Bl -tag -width Ic
162.It Ic h
163Help: display a summary of these commands.
164If you forget all the other commands, remember this one.
165.It Xo
166.Ic SPACE
167.No or
168.Ic f
169.No or
170.Ic \&^F
171.Xc
172Scroll forward N lines, default one window.
173If N is more than the screen size, only the final screenful is displayed.
174.It Ic b No or Ic \&^B
175Scroll backward N lines, default one window (see option -z below).
176If N is more than the screen size, only the final screenful is displayed.
177.It Ic j No or Ic RETURN
178Scroll forward N lines, default 1.
179The entire N lines are displayed, even if N is more than the screen size.
180.It Ic k
181Scroll backward N lines, default 1.
182The entire N lines are displayed, even if N is more than the screen size.
183.It Ic d No or Ic \&^D
184Scroll forward N lines, default one half of the screen size.
185If N is specified, it becomes the new default for
186subsequent d and u commands.
187.It Ic u No or Ic \&^U
188Scroll backward N lines, default one half of the screen size.
189If N is specified, it becomes the new default for
190subsequent d and u commands.
191.It Ic g
192Go to line N in the file, default 1 (beginning of file).
193.It Ic G
194Go to line N in the file, default the end of the file.
195.It Ic p No or Ic \&%
196Go to a position N percent into the file.  N should be between 0
197and 100.  (This works if standard input is being read, but only if
198.Nm
199has already read to the end of the file.  It is always fast, but
200not always useful.)
201.It Ic r No or Ic \&^L
202Repaint the screen.
203.It Ic R
204Repaint the screen, discarding any buffered input.
205Useful if the file is changing while it is being viewed.
206.It Ic m
207Followed by any lowercase letter,
208marks the current position with that letter.
209.It Ic \&'
210(Single quote.)
211Followed by any lowercase letter, returns to the position which
212was previously marked with that letter.
213Followed by another single quote, returns to the position at
214which the last "large" movement command was executed, or the
215beginning of the file if no such movements have occurred.
216All marks are lost when a new file is examined.
217.It Ic \&/ Ns Ar pattern
218Search forward in the file for the N-th line containing the pattern.
219N defaults to 1.
220The pattern is a regular expression, as recognized by
221.Xr ed 1 .
222The search starts at the second line displayed.
223.It Ic \&? Ns Ar pattern
224Search backward in the file for the N-th line containing the pattern.
225The search starts at the line immediately before the top line displayed.
226.It Ic \&/\&! Ns Ar pattern
227Like /, but the search is for the N-th line
228which does NOT contain the pattern.
229.It Ic \&?\&! Ns Ar pattern
230Like ?, but the search is for the N-th line
231which does NOT contain the pattern.
232.It Ic n
233Repeat previous search, for N-th line containing the last pattern
234(or
235.Tn NOT
236containing the last pattern, if the previous search
237was /! or ?!).
238.It Ic E Ns Op Ar filename
239Examine a new file.
240If the filename is missing, the "current" file (see the N and P commands
241below) from the list of files in the command line is re-examined.
242If the filename is a pound sign (#), the previously examined file is
243re-examined.
244.It Ic N No or Ic \&:n
245Examine the next file (from the list of files given in the command line).
246If a number N is specified (not to be confused with the command N),
247the N-th next file is examined.
248.It Ic P No or Ic \&:p
249Examine the previous file.
250If a number N is specified, the N-th previous file is examined.
251.It Ic \&:t
252Go to supplied tag.
253.It Ic v
254Invokes an editor to edit the current file being viewed.
255The editor is taken from the environment variable
256.Ev EDITOR ,
257or defaults to
258.Xr vi  1  .
259.It Ic \&= No or Ic \&^G
260These options print out the number of the file currently being displayed
261relative to the total number of files there are to display, the current
262line number, the current byte number and the total bytes to display, and
263what percentage of the file has been displayed.
264If
265.Nm
266is reading from stdin, or the file is shorter than a single screen, some
267of these items may not be available.  Note, all of these items reference
268the first byte of the last line displayed on the screen.
269.It Xo
270.Ic q
271.No or
272.Ic \&:q
273.No or
274.Ic ZZ
275.Xc
276Exits
277.Nm "" .
278.El
279.Sh ENVIRONMENT
280The
281.Nm
282command utilizes the following environment variables, if they exist:
283.Bl -tag -width Fl
284.It Ev MORE
285This variable may be set with favored options to
286.Nm "" .
287.It Ev EDITOR
288Specify default editor.
289.It Ev SHELL
290Current shell in use (normally set by the shell at login time).
291.It Ev TERM
292Specifies terminal type, used by more to get the terminal
293characteristics necessary to manipulate the screen.
294.El
295.Sh SEE ALSO
296.Xr ctags 1 ,
297.Xr vi 1
298.Sh HISTORY
299The
300.Nm
301command appeared in
302.Bx 3.0 .
303.Sh AUTHORS
304This software is derived from software contributed to Berkeley
305by Mark Nudleman.
306