xref: /openbsd/distrib/special/more/more.1 (revision 2a110ee1)
1.\" $OpenBSD: more.1,v 1.12 2020/01/16 16:46:46 schwarze Exp $
2.\"
3.\" Copyright (c) 1980 The Regents of the University of California.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	@(#)more.1	5.15 (Berkeley) 7/29/91
31.\"
32.Dd $Mdocdate: January 16 2020 $
33.Dt MORE 1
34.Os
35.Sh NAME
36.Nm more , page
37.Nd view files
38.Sh SYNOPSIS
39.Nm more
40.Op Fl cdflpsu
41.Op \- Ns Ar num
42.Op + Ns Ar linenumber
43.Op +/ Ns Ar pattern
44.Op Ar
45.Nm page
46.Op Fl cdflpsu
47.Op \- Ns Ar num
48.Op + Ns Ar linenumber
49.Op +/ Ns Ar pattern
50.Op Ar
51.Sh DESCRIPTION
52.Nm more
53is a filter which allows examination of a continuous text
54one screenful at a time on a soft-copy terminal.
55It normally pauses after each screenful, printing --More--
56at the bottom of the screen.
57If the user then types a carriage return, one more line is displayed.
58If the user hits a space, another screenful is displayed.
59Other possibilities are enumerated later.
60.Pp
61The options are as follows:
62.Bl -tag -width Ds
63.It Fl c
64.Nm
65will draw each page by beginning at the top of the screen and erasing
66each line just before it draws on it.
67This avoids scrolling the screen, making it easier to read while
68.Nm
69is writing.
70This option will be ignored if the terminal does not have the ability
71to clear to the end of a line.
72.It Fl d
73.Nm
74will prompt the user with the message "[Press space to continue, 'q' to
75quit.]" at the end of each screenful, and will display
76"[Press 'h' for instructions.]" instead of ringing the bell when an
77illegal key is pressed.
78This is useful if
79.Nm
80is being used as a filter in some setting, such as a class,
81where many users may be unsophisticated.
82.It Fl f
83Causes
84.Nm
85to count logical, rather than screen lines (i.e., long lines are not folded).
86This option is recommended if
87.Xr mandoc 1
88output is being piped through
89.Xr ul 1 ,
90since the latter may generate escape sequences.
91These escape sequences contain characters which would ordinarily occupy
92screen positions, but which do not print when they are sent to the
93terminal as part of an escape sequence.
94Thus,
95.Nm
96may think that lines are longer than they actually are, and fold
97lines erroneously.
98.It Fl l
99Do
100not treat
101.Ic ^\&L
102(form feed) specially.
103If this option is not given,
104.Nm
105will pause after any line that contains a
106.Ic ^\&L ,
107as if the end of a screenful had been reached.
108Also, if a file begins with a form feed, the screen will be cleared
109before the file is printed.
110.It Fl p
111A deprecated alias for the
112.Fl c
113option.
114.It Fl s
115Squeeze multiple blank lines from the output, producing only one blank
116line.
117This maximizes the useful information present on the screen.
118.It Fl u
119Suppress underlining.
120Normally,
121.Nm
122will handle underlining such as produced by
123.Xr mandoc 1
124in a manner appropriate to the particular terminal:
125if the terminal can perform underlining or has a stand-out mode,
126.Nm
127will output appropriate escape sequences to enable underlining or stand-out
128mode for underlined information in the source file.
129.It \- Ns Ar num
130An integer specifying the size (in lines) of the window which
131.Nm
132will use instead of the default.
133On a terminal capable of displaying 24 lines, the default
134window size is 23 lines.
135.It + Ns Ar linenumber
136Start at the specified
137.Ar linenumber .
138.It +/ Ns Ar pattern
139Start two lines before the line matching the
140regular expression
141.Ar pattern .
142.El
143.Pp
144If the program is invoked as
145.Nm page ,
146then the screen is cleared before each screenful is printed (but only
147if a full screenful is being printed).
148.Pp
149If
150.Nm
151is reading from a file, rather than a pipe, then a percentage is displayed
152along with the --More-- prompt.
153This gives the fraction of the file (in characters, not lines) that has been
154read so far.
155.Ss Command Sequences
156Command sequences (similar to
157.Xr vi 1 )
158may be typed when
159.Nm
160pauses.
161In the following list,
162.Em i
163is an optional integer argument, defaulting to 1.
164In the following descriptions, ^X means control-X.
165.Bl -tag -width Ds
166.It Em i Ns Aq space
167Display
168.Em i
169more lines, (or another screenful if no argument is given).
170.It ^D
171Display 11 more lines (a
172.Dq scroll ) .
173If
174.Em i
175is given, then the scroll size is set to
176.Em i .
177.It d
178Same as ^D (control-D).
179.It Em i Ns z
180Same as typing a space except that
181.Em i ,
182if present, becomes the new window size.
183.It Em i Ns s
184Skip
185.Em i
186lines and print a screenful of lines.
187.It Em i Ns f
188Skip
189.Em i
190screenfuls and print a screenful of lines.
191.It Em i Ns b
192Skip back
193.Em i
194screenfuls and print a screenful of lines.
195.It Em i Ns ^B
196Same as
197.Sq b .
198.It q
199Exit from
200.Nm more .
201.It Q
202Same as
203.Sq q .
204.It =
205Display the current line number.
206.It v
207Start up the editor at the current line.
208.It h
209Help command; give a description of all the
210.Nm
211commands.
212.It Em i Ns / Ar expr
213Search for the
214.Em i Ns -th
215occurrence of the regular expression
216.Ar expr .
217If there are less than
218.Em i
219occurrences of
220.Ar expr
221and the input is a file (rather than a pipe),
222then the position in the file remains unchanged.
223Otherwise, a screenful is displayed, starting two lines before the place
224where the expression was found.
225The user's erase and kill characters may be used to edit the regular
226expression.
227Erasing back past the first column cancels the search command.
228.It Em i Ns n
229Search for the
230.Em i Ns -th
231occurrence of the last regular expression entered.
232.It \&' (single quote)
233Go to the point from which the last search started.
234If no search has been performed in the current file, this command
235goes back to the beginning of the file.
236.It ! Ns Ar command
237Invoke a shell with
238.Ar command .
239The characters
240.Sq %
241and
242.Sq !\&
243in
244.Ar command
245are replaced with the current file name and the previous shell command
246respectively.
247If there is no current file name,
248.Sq %
249is not expanded.
250The sequences
251.Sq \e%
252and
253.Sq \e!
254are replaced by
255.Sq %
256and
257.Sq !\&
258respectively.
259.It Em i : Ns Ar n
260Skip to the
261.Ar i Ns -th
262next file given in the command line (skips to last file if
263.Ar n
264doesn't make sense).
265.It Em i : Ns Ar p
266Skip to the
267.Ar i Ns -th
268previous file given in the command line.
269If this command is given in the middle of printing out a file,
270.Nm
271goes back to the beginning of the file.
272If
273.Ar i
274doesn't make sense,
275.Nm
276skips back to the first file.
277If
278.Nm
279is not reading from a file, the bell is rung and nothing else happens.
280.It :f
281Display the current file name and line number.
282.It :q or :Q
283Exit from
284.Nm
285(same as q or Q).
286.It \&. (dot)
287Repeat the previous command.
288.El
289.Pp
290Commands take effect immediately, i.e., it is not necessary to
291type a carriage return.
292Up to the time when the command character itself is given,
293the user may hit the line kill character to cancel the numerical
294argument being formed.
295In addition, the user may hit the erase character to redisplay the
296--More--(xx%) message.
297.Pp
298At any time when output is being sent to the terminal, the user can
299hit the quit key (normally control\-\e).
300.Nm
301will stop sending output, and will display the usual --More--
302prompt.
303The user may then enter one of the above commands in the normal manner.
304Unfortunately, some output is lost when this is done, due to the
305fact that any characters waiting in the terminal's output queue
306are flushed when the quit signal occurs.
307.Pp
308The terminal is set to
309.Dq noecho
310mode by this program so that the output can be continuous.
311What you type will thus not show on your terminal, except for the / and !\&
312commands.
313.Pp
314If the standard output is not a teletype, then
315.Nm
316acts just like
317.Xr cat 1 ,
318except that a header is printed before each file (if there is
319more than one).
320.Sh ENVIRONMENT
321.Bl -tag -width Ds
322.It Ev EDITOR
323Editor to be used by the
324.Ic v
325command.
326.It Ev MORE
327A space-separated list of flags to pre-set when running
328.Nm more .
329Note that flags on the command line override those found in
330.Ev MORE .
331.It Ev SHELL
332Shell to be used when running commands.
333If this variable is not set,
334.Pa /bin/sh
335is used.
336.It Ev TERM
337The user's terminal type.
338.It Ev VISUAL
339Editor used in preference to that specified by
340.Ev EDITOR .
341.El
342.Sh FILES
343.Bl -tag -width /usr/share/misc/omore.helpXX -compact
344.It Pa /usr/share/misc/termcap
345Terminal data base
346.It Pa /usr/bin/vi
347Default editor
348.El
349.Sh EXAMPLES
350A sample usage of
351.Nm
352in previewing
353.Xr mandoc 1
354output would be:
355.Pp
356.Dl mandoc doc.1 | more
357.Sh SEE ALSO
358.Xr cat 1 ,
359.Xr mandoc 1 ,
360.Xr sh 1 ,
361.Xr ul 1 ,
362.Xr vi 1 ,
363.Xr environ 7
364.Sh HISTORY
365The
366.Nm
367command appeared in
368.Bx 3.0 .
369.Sh BUGS
370Skipping backwards is too slow on large files.
371