xref: /openbsd/usr.bin/less/more.1 (revision a6445c1d)
1.\"	$OpenBSD: more.1,v 1.17 2014/04/25 22:28:42 jmc Exp $
2.\"
3.\" Copyright (c) 1988, 1990, 1993
4.\"	The Regents of the University of California.  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	8.2 (Berkeley) 4/18/94
31.\"
32.Dd $Mdocdate: April 25 2014 $
33.Dt MORE 1
34.Os
35.Sh NAME
36.Nm more
37.Nd view files
38.Sh SYNOPSIS
39.Nm more
40.Op Fl ceisu
41.Op Fl n Ar number
42.Op Fl p Ar command
43.Op Fl t Ar tag
44.Op Ar
45.Sh DESCRIPTION
46The
47.Nm
48pager displays text one screenful at a time.
49After showing each screenful, it prompts the user for a command.
50Most commands scroll the text or move to a different place
51in the file, while some switch to another file.
52If no
53.Ar file
54is specified, or if
55.Ar file
56is a single dash
57.Pq Ql - ,
58the standard input is used.
59.Pp
60When showing the last line of a file,
61.Nm
62displays a prompt indicating end of file and the name of the next file
63to examine, if any.
64It then waits for input from the user.
65Scrolling forward switches to the next file,
66or exits if there is none.
67.Pp
68This version of
69.Nm
70is actually
71.Xr less 1
72in disguise.
73As such, it will also accept options documented in
74.Xr less 1 .
75This manual page describes only features
76relevant to a POSIX compliant
77.Nm .
78.Pp
79The options are as follows:
80.Bl -tag -width Ds
81.It Fl c
82When changing the display, paint from the top line down.
83The default is to scroll from the bottom of the screen.
84.It Fl e
85Exit immediately after showing the last line of the last file,
86without prompting the user for a command first.
87.It Fl i
88Ignore case.
89Upper case and lower case are considered identical.
90.It Fl n Ar number
91Page
92.Ar number
93of lines per screenful.
94By default,
95.Nm
96uses the terminal window size.
97.It Fl p Ar command
98Execute the specified
99.Nm
100commands when a file is first examined (or re-examined, such as with the
101.Ic :e
102or
103.Ic :p
104commands).
105Multiple commands have to be concatenated into one single argument.
106Search patterns may contain blank characters and can be terminated
107by newline characters embedded in the
108.Ar command
109argument.
110Any other blank and newline characters contained in the argument are
111interpreted as
112.Ic SPACE
113and
114.Ic RETURN
115commands, respectively.
116.It Fl s
117Squeeze consecutive blank lines into a single blank line.
118.It Fl t Ar tag
119Examine the file containing
120.Ar tag .
121For more information, see
122.Xr ctags  1 .
123.It Fl u
124Display backspaces as control characters
125.Pq Sq ^H
126and leave CR-LF sequences alone.
127By default,
128.Nm
129treats backspaces and CR-LF sequences specially:
130backspaces which appear adjacent to an underscore character are
131displayed as underlined text;
132backspaces which appear between two identical characters are displayed
133as emboldened text;
134and CR-LF sequences are compressed to a single linefeed character.
135.El
136.Sh COMMANDS
137Interactive commands for
138.Nm
139are based on
140.Xr vi  1  .
141Some commands may be preceded by a decimal number, called N in the
142descriptions below.
143In the following descriptions, ^X means control-X.
144.Bl -tag -width Ic
145.It Ic h
146Help: display a summary of these commands.
147.It Ic SPACE | f | ^F
148Scroll forward N lines, default one window.
149If N is more than the screen size, only the final screenful is displayed.
150.It Ic b | ^B
151Scroll backward N lines, default one window (see the
152.Fl n
153option).
154If N is more than the screen size, only the final screenful is displayed.
155.It Ic j | RETURN
156Scroll forward N lines, default 1.
157The entire N lines are displayed, even if N is more than the screen size.
158.It Ic k
159Scroll backward N lines, default 1.
160The entire N lines are displayed, even if N is more than the screen size.
161.It Ic d | ^D
162Scroll forward N lines, default one half of the screen size.
163If N is specified, it becomes the new default for
164subsequent d and u commands.
165.It Ic u | ^U
166Scroll backward N lines, default one half of the screen size.
167If N is specified, it becomes the new default for
168subsequent d and u commands.
169.It Ic g
170Go to line N in the file, default 1 (beginning of file).
171.It Ic G
172Go to line N in the file, default the end of the file.
173.It Ic r | ^L
174Repaint the screen.
175.It Ic R
176Repaint the screen, discarding any buffered input.
177Useful if the file is changing while it is being viewed.
178.It Ic m
179Followed by any lowercase letter,
180marks the current position with that letter.
181.It Ic '
182(Single quote.)
183Followed by any lowercase letter, returns to the position which
184was previously marked with that letter.
185Followed by another single quote, returns to the position at
186which the last "large" movement command was executed, or the
187beginning of the file if no such movements have occurred.
188All marks are lost when a new file is examined.
189.It Ic / Ns Ar pattern
190Search forward in the file for the N-th line containing the pattern.
191N defaults to 1.
192The pattern is a basic regular expression (BRE).
193See
194.Xr re_format 7
195for more information on regular expressions.
196The search starts at the second line displayed.
197.It Ic ?\& Ns Ar pattern
198Search backward in the file for the N-th line containing the pattern.
199The search starts at the line immediately before the top line displayed.
200.It Ic /! Ns Ar pattern
201Like /, but the search is for the N-th line
202which does NOT contain the pattern.
203.It Ic ?! Ns Ar pattern
204Like ?, but the search is for the N-th line
205which does NOT contain the pattern.
206.It Ic n
207Repeat previous search, for N-th line containing the last pattern
208(or NOT containing the last pattern,
209if the previous search was /! or ?!).
210.It Ic N
211Repeat previous search in the opposite direction,
212for N-th line containing the last pattern
213(or NOT containing the last pattern,
214if the previous search was /! or ?!).
215.It Ic :e Op Ar filename
216Examine a new file.
217If the filename is missing, the "current" file (see the
218.Ic :n
219and
220.Ic :p
221commands below)
222from the list of files in the command line is re-examined.
223If the filename is a pound sign (#), the previously examined file is
224re-examined.
225.It Ic :n
226Examine the next file (from the list of files given in the command line).
227If a number N is specified (not to be confused with the command N),
228the N-th next file is examined.
229.It Ic :p
230Examine the previous file.
231If a number N is specified, the N-th previous file is examined.
232.It Ic :t
233Go to supplied tag.
234.It Ic v
235Invokes an editor to edit the current file being viewed.
236The editor is taken from the environment variable
237.Ev EDITOR ,
238or defaults to
239.Xr vi 1 .
240.It Ic = | ^G
241These options print out the number of the file currently being displayed
242relative to the total number of files there are to display, the current
243line number, the current byte number and the total bytes to display, and
244what percentage of the file has been displayed.
245If
246.Nm
247is reading from the standard input,
248or the file is shorter than a single screen, some
249of these items may not be available.
250Note, all of these items reference the first byte of the last line
251displayed on the screen.
252.It Ic q | :q | ZZ
253Exits
254.Nm .
255.El
256.Sh ENVIRONMENT
257.Bl -tag -width "COLUMNSXXX"
258.It Ev COLUMNS
259Sets the number of columns on the screen.
260Takes precedence over the number of columns specified by the
261.Ev TERM
262variable,
263but may be overridden by window systems which support
264.Dv TIOCGWINSZ .
265.It Ev EDITOR
266Specifies the default editor.
267If not set,
268.Xr vi 1
269is used.
270.It Ev LINES
271Sets the number of lines on the screen.
272Takes precedence over the number of lines specified by the TERM variable,
273but may be overridden by window systems which support
274.Dv TIOCGWINSZ .
275.It Ev MORE
276Default command line options to use with
277.Nm .
278The options should be space-separated and must be prefixed with a dash
279.Pq Ql - .
280.It Ev TERM
281Specifies the terminal type.
282Used by
283.Nm
284to get the terminal characteristics necessary to manipulate the screen.
285.El
286.Sh EXIT STATUS
287.Ex -std more
288.Sh EXAMPLES
289Examine the ends of all files in the current directory, showing line
290and byte counts for each:
291.Pp
292.Dl $ more -p G= *
293.Pp
294Examine several manual pages, starting from the options description
295in the DESCRIPTION section:
296.Bd -literal -offset indent
297$ more -p '/DESCRIPTION
298> /options
299> ' *.1
300.Ed
301.Sh SEE ALSO
302.Xr ctags 1 ,
303.Xr less 1 ,
304.Xr vi 1 ,
305.Xr re_format 7
306.Sh STANDARDS
307The
308.Nm
309utility is compliant with the
310.St -p1003.1-2008
311specification,
312though its presence is optional.
313.Pp
314Functionality allowing the user to skip (as opposed to scroll)
315forward is not currently implemented.
316.Sh HISTORY
317A
318.Nm
319command appeared in
320.Bx 3.0 .
321.Sh AUTHORS
322.An Mark Nudelman Aq Mt markn@greenwoodsoftware.com
323