xref: /netbsd-src/distrib/utils/more/more.1 (revision 4472dbe5e3bd91ef2540bada7a7ca7384627ff9b)
1.\"	$NetBSD: more.1,v 1.3 1998/04/28 18:17:33 fair 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.Sh COMMANDS
152Interactive commands for
153.Nm
154are based on
155.Xr vi  1  .
156Some commands may be preceded by a decimal number, called N in the
157descriptions below.
158In the following descriptions, ^X means control-X.
159.Pp
160.Bl -tag -width Ic
161.It Ic h
162Help: display a summary of these commands.
163If you forget all the other commands, remember this one.
164.It Xo
165.Ic SPACE
166.No or
167.Ic f
168.No or
169.Ic \&^F
170.Xc
171Scroll forward N lines, default one window.
172If N is more than the screen size, only the final screenful is displayed.
173.It Ic b No or Ic \&^B
174Scroll backward N lines, default one window (see option -z below).
175If N is more than the screen size, only the final screenful is displayed.
176.It Ic j No or Ic RETURN
177Scroll forward N lines, default 1.
178The entire N lines are displayed, even if N is more than the screen size.
179.It Ic k
180Scroll backward N lines, default 1.
181The entire N lines are displayed, even if N is more than the screen size.
182.It Ic d No or Ic \&^D
183Scroll forward N lines, default one half of the screen size.
184If N is specified, it becomes the new default for
185subsequent d and u commands.
186.It Ic u No or Ic \&^U
187Scroll backward N lines, default one half of the screen size.
188If N is specified, it becomes the new default for
189subsequent d and u commands.
190.It Ic g
191Go to line N in the file, default 1 (beginning of file).
192.It Ic G
193Go to line N in the file, default the end of the file.
194.It Ic p No or Ic \&%
195Go to a position N percent into the file.  N should be between 0
196and 100.  (This works if standard input is being read, but only if
197.Nm
198has already read to the end of the file.  It is always fast, but
199not always useful.)
200.It Ic r No or Ic \&^L
201Repaint the screen.
202.It Ic R
203Repaint the screen, discarding any buffered input.
204Useful if the file is changing while it is being viewed.
205.It Ic m
206Followed by any lowercase letter,
207marks the current position with that letter.
208.It Ic \&'
209(Single quote.)
210Followed by any lowercase letter, returns to the position which
211was previously marked with that letter.
212Followed by another single quote, returns to the position at
213which the last "large" movement command was executed, or the
214beginning of the file if no such movements have occurred.
215All marks are lost when a new file is examined.
216.It Ic \&/ Ns Ar pattern
217Search forward in the file for the N-th line containing the pattern.
218N defaults to 1.
219The pattern is a regular expression, as recognized by
220.Xr ed 1 .
221The search starts at the second line displayed.
222.It Ic \&? Ns Ar pattern
223Search backward in the file for the N-th line containing the pattern.
224The search starts at the line immediately before the top line displayed.
225.It Ic \&/\&! Ns Ar pattern
226Like /, but the search is for the N-th line
227which does NOT contain the pattern.
228.It Ic \&?\&! Ns Ar pattern
229Like ?, but the search is for the N-th line
230which does NOT contain the pattern.
231.It Ic n
232Repeat previous search, for N-th line containing the last pattern
233(or
234.Tn NOT
235containing the last pattern, if the previous search
236was /! or ?!).
237.It Ic E Ns Op Ar filename
238Examine a new file.
239If the filename is missing, the "current" file (see the N and P commands
240below) from the list of files in the command line is re-examined.
241If the filename is a pound sign (#), the previously examined file is
242re-examined.
243.It Ic N No or Ic \&:n
244Examine the next file (from the list of files given in the command line).
245If a number N is specified (not to be confused with the command N),
246the N-th next file is examined.
247.It Ic P No or Ic \&:p
248Examine the previous file.
249If a number N is specified, the N-th previous file is examined.
250.It Ic \&:t
251Go to supplied tag.
252.It Ic v
253Invokes an editor to edit the current file being viewed.
254The editor is taken from the environment variable
255.Ev EDITOR ,
256or defaults to
257.Xr vi  1  .
258.It Ic \&= No or Ic \&^G
259These options print out the number of the file currently being displayed
260relative to the total number of files there are to display, the current
261line number, the current byte number and the total bytes to display, and
262what percentage of the file has been displayed.
263If
264.Nm
265is reading from stdin, or the file is shorter than a single screen, some
266of these items may not be available.  Note, all of these items reference
267the first byte of the last line displayed on the screen.
268.It Xo
269.Ic q
270.No or
271.Ic \&:q
272.No or
273.Ic ZZ
274.Xc
275Exits
276.Nm "" .
277.El
278.Sh ENVIRONMENT
279The
280.Nm
281command utilizes the following environment variables, if they exist:
282.Bl -tag -width Fl
283.It Ev MORE
284This variable may be set with favored options to
285.Nm "" .
286.It Ev EDITOR
287Specify default editor.
288.It Ev SHELL
289Current shell in use (normally set by the shell at login time).
290.It Ev TERM
291Specifies terminal type, used by more to get the terminal
292characteristics necessary to manipulate the screen.
293.El
294.Sh SEE ALSO
295.Xr ctags 1 ,
296.Xr vi 1
297.Sh AUTHOR
298This software is derived from software contributed to Berkeley
299by Mark Nudleman.
300.Sh HISTORY
301The
302.Nm
303command appeared in
304.Bx 3.0 .
305