xref: /openbsd/distrib/special/more/more.1 (revision 404b540a)
1.\" $OpenBSD: more.1,v 1.10 2007/05/31 19:19:16 jmc 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: May 31 2007 $
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 nroff 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.
117Especially helpful when viewing
118.Xr nroff 1
119output, this option maximizes the useful information present on the screen.
120.It Fl u
121Suppress underlining.
122Normally,
123.Nm
124will handle underlining such as produced by
125.Xr nroff 1
126in a manner appropriate to the particular terminal:
127if the terminal can perform underlining or has a stand-out mode,
128.Nm
129will output appropriate escape sequences to enable underlining or stand-out
130mode for underlined information in the source file.
131.It \- Ns Ar num
132An integer specifying the size (in lines) of the window which
133.Nm
134will use instead of the default.
135On a terminal capable of displaying 24 lines, the default
136window size is 23 lines.
137.It + Ns Ar linenumber
138Start at the specified
139.Ar linenumber .
140.It +/ Ns Ar pattern
141Start two lines before the line matching the
142regular expression
143.Ar pattern .
144.El
145.Pp
146If the program is invoked as
147.Nm page ,
148then the screen is cleared before each screenful is printed (but only
149if a full screenful is being printed).
150.Pp
151If
152.Nm
153is reading from a file, rather than a pipe, then a percentage is displayed
154along with the --More-- prompt.
155This gives the fraction of the file (in characters, not lines) that has been
156read so far.
157.Ss Command Sequences
158Command sequences (similar to
159.Xr vi 1 )
160may be typed when
161.Nm
162pauses.
163In the following list,
164.Em i
165is an optional integer argument, defaulting to 1.
166In the following descriptions, ^X means control-X.
167.Bl -tag -width Ds
168.It Em i Ns Aq space
169Display
170.Em i
171more lines, (or another screenful if no argument is given).
172.It ^D
173Display 11 more lines (a
174.Dq scroll ) .
175If
176.Em i
177is given, then the scroll size is set to
178.Em i .
179.It d
180Same as ^D (control-D).
181.It Em i Ns z
182Same as typing a space except that
183.Em i ,
184if present, becomes the new window size.
185.It Em i Ns s
186Skip
187.Em i
188lines and print a screenful of lines.
189.It Em i Ns f
190Skip
191.Em i
192screenfuls and print a screenful of lines.
193.It Em i Ns b
194Skip back
195.Em i
196screenfuls and print a screenful of lines.
197.It Em i Ns ^B
198Same as
199.Sq b .
200.It q
201Exit from
202.Nm more .
203.It Q
204Same as
205.Sq q .
206.It =
207Display the current line number.
208.It v
209Start up the editor at the current line.
210.It h
211Help command; give a description of all the
212.Nm
213commands.
214.It Em i Ns / Ar expr
215Search for the
216.Em i Ns -th
217occurrence of the regular expression
218.Ar expr .
219If there are less than
220.Em i
221occurrences of
222.Ar expr
223and the input is a file (rather than a pipe),
224then the position in the file remains unchanged.
225Otherwise, a screenful is displayed, starting two lines before the place
226where the expression was found.
227The user's erase and kill characters may be used to edit the regular
228expression.
229Erasing back past the first column cancels the search command.
230.It Em i Ns n
231Search for the
232.Em i Ns -th
233occurrence of the last regular expression entered.
234.It \&' (single quote)
235Go to the point from which the last search started.
236If no search has been performed in the current file, this command
237goes back to the beginning of the file.
238.It ! Ns Ar command
239Invoke a shell with
240.Ar command .
241The characters
242.Sq %
243and
244.Sq !\&
245in
246.Ar command
247are replaced with the current file name and the previous shell command
248respectively.
249If there is no current file name,
250.Sq %
251is not expanded.
252The sequences
253.Sq \e%
254and
255.Sq \e!
256are replaced by
257.Sq %
258and
259.Sq !\&
260respectively.
261.It Em i : Ns Ar n
262Skip to the
263.Ar i Ns -th
264next file given in the command line (skips to last file if
265.Ar n
266doesn't make sense).
267.It Em i : Ns Ar p
268Skip to the
269.Ar i Ns -th
270previous file given in the command line.
271If this command is given in the middle of printing out a file,
272.Nm
273goes back to the beginning of the file.
274If
275.Ar i
276doesn't make sense,
277.Nm
278skips back to the first file.
279If
280.Nm
281is not reading from a file, the bell is rung and nothing else happens.
282.It :f
283Display the current file name and line number.
284.It :q or :Q
285Exit from
286.Nm
287(same as q or Q).
288.It \&. (dot)
289Repeat the previous command.
290.El
291.Pp
292Commands take effect immediately, i.e., it is not necessary to
293type a carriage return.
294Up to the time when the command character itself is given,
295the user may hit the line kill character to cancel the numerical
296argument being formed.
297In addition, the user may hit the erase character to redisplay the
298--More--(xx%) message.
299.Pp
300At any time when output is being sent to the terminal, the user can
301hit the quit key (normally control\-\e).
302.Nm
303will stop sending output, and will display the usual --More--
304prompt.
305The user may then enter one of the above commands in the normal manner.
306Unfortunately, some output is lost when this is done, due to the
307fact that any characters waiting in the terminal's output queue
308are flushed when the quit signal occurs.
309.Pp
310The terminal is set to
311.Dq noecho
312mode by this program so that the output can be continuous.
313What you type will thus not show on your terminal, except for the / and !\&
314commands.
315.Pp
316If the standard output is not a teletype, then
317.Nm
318acts just like
319.Xr cat 1 ,
320except that a header is printed before each file (if there is
321more than one).
322.Sh ENVIRONMENT
323.Bl -tag -width Fl
324.It Ev EDITOR
325Editor to be used by the
326.Ic v
327command.
328.It Ev MORE
329A space-separated list of flags to pre-set when running
330.Nm more .
331Note that flags on the command line override those found in
332.Ev MORE .
333.It Ev SHELL
334Shell to be used when running commands.
335If this variable is not set,
336.Pa /bin/sh
337is used.
338.It Ev TERM
339The user's terminal type.
340.It Ev VISUAL
341Editor used in preference to that specified by
342.Ev EDITOR .
343.El
344.Sh FILES
345.Bl -tag -width /usr/share/misc/omore.helpXX -compact
346.It Pa /usr/share/misc/termcap
347Terminal data base
348.It Pa /usr/bin/vi
349Default editor
350.El
351.Sh EXAMPLES
352A sample usage of
353.Nm
354in previewing
355.Xr nroff 1
356output would be:
357.Pp
358.Dl nroff -ms doc.n | more -s
359.Sh SEE ALSO
360.Xr cat 1 ,
361.Xr nroff 1 ,
362.Xr sh 1 ,
363.Xr ul 1 ,
364.Xr vi 1 ,
365.Xr environ 7
366.Sh HISTORY
367The
368.Nm
369command appeared in
370.Bx 3.0 .
371.Sh BUGS
372Skipping backwards is too slow on large files.
373