freebsd-nq/usr.bin/more/more.1
Sheldon Hearn 87faa07bec Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.
2000-03-01 12:20:22 +00:00

339 lines
10 KiB
Groff

.\" Copyright (c) 1988, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)more.1 8.2 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd April 18, 1994
.Dt MORE 1
.Os
.Sh NAME
.Nm more
.Nd file perusal filter for crt viewing
.Sh SYNOPSIS
.Nm
.Op Fl ceinsu
.Op Fl t Ar tag
.Op Fl x Ar tabs
.Op Fl / Ar pattern
.Op Ar
.Sh DESCRIPTION
.Nm More
is a filter for paging through text one screenful at a time. It
uses
.Xr termcap 3
so it can run on a variety of terminals. There is even limited support
for hardcopy terminals. (On a hardcopy terminal, lines which should be
printed at the top of the screen are prefixed with an up-arrow.)
.Ar File
may be a single dash (``-''), implying stdin.
.Sh OPTIONS
Command line options are described below.
Options are also taken from the environment variable
.Ev MORE
(make sure to precede them with a dash (``-'')) but command
line options will override them.
.Bl -tag -width flag
.It Fl c
Normally,
.Nm
will repaint the screen by scrolling from the bottom of the screen.
If the
.Fl c
option is set, when
.Nm
needs to change the entire display, it will paint from the top line down.
.It Fl e
Normally, if displaying a single file,
.Nm
exits as soon as it reaches end-of-file. The
.Fl e
option tells
.Nm
to
exit if it reaches end-of-file twice without an intervening operation.
.It Fl i
The
.Fl i
option causes searches to ignore case; that is,
uppercase and lowercase are considered identical.
.It Fl n
The
.Fl n
flag suppresses line numbers.
The default (to use line numbers) may cause
.Nm
to run more slowly in some cases, especially with a very large input file.
Suppressing line numbers with the
.Fl n
flag will avoid this problem.
Using line numbers means: the line number will be displayed in the
.Cm =
command, and the
.Cm v
command will pass the current line number to the editor.
.It Fl s
The
.Fl s
option causes
consecutive blank lines to be squeezed into a single blank line.
.It Fl t
The
.Fl t
option, followed immediately by a tag, will edit the file
containing that tag. For more information, see the
.Xr ctags 1
command.
.It Fl u
By default,
.Nm
treats backspaces and
.Dv CR-LF
sequences specially. Backspaces which appear
adjacent to an underscore character are displayed as underlined text.
Backspaces which appear between two identical characters are displayed
as emboldened text.
.Dv CR-LF
sequences are compressed to a single newline
character. The
.Fl u
option causes backspaces to always be displayed as
control characters, i.e. as the two character sequence ``^H'', and
.Dv CR-LF
to be left alone.
.It Fl x
The
.Fl x
option sets tab stops every
.Ar N
positions.
The default for
.Ar N
is 8.
.It Fl /
The
.Fl /
option specifies a string that will be searched for before
each file is displayed.
.Sh COMMANDS
Interactive commands for
.Nm
are based on
.Xr vi 1 .
Some commands may be preceded by a decimal number, called N in the
descriptions below.
In the following descriptions, ^X means control-X.
.Pp
.Bl -tag -width Ic
.It Ic h
Help: display a summary of these commands.
If you forget all the other commands, remember this one.
.It Xo
.Ic SPACE
.No or
.Ic f
.No or
.Ic \&^F
.Xc
Scroll forward N lines, default one window.
If N is more than the screen size, only the final screenful is displayed.
.It Ic b No or Ic \&^B
Scroll backward N lines, default one window (see option -z below).
If N is more than the screen size, only the final screenful is displayed.
.It Xo
.Ic j
.No or
.Ic RETURN
.No or
.Ic DOWN-ARROW
.Xc
Scroll forward N lines, default 1.
The entire N lines are displayed, even if N is more than the screen size.
.It Ic k No or Ic UP-ARROW
Scroll backward N lines, default 1.
The entire N lines are displayed, even if N is more than the screen size.
.It Ic LEFT-ARROW
Scroll leftwards N columns, default 1, or turn on line-wrapping if the
screen is cannot be scrolled leftwards.
.It Ic RIGHT-ARROW
Turn off line-wrapping or scroll rightwards N columns, default 1,
if line wrapping is already off.
.It Ic HOME
Toggle horizontal scrolling and associated line-wrapping on and off.
.It Ic d No or Ic \&^D
Scroll forward N lines, default one half of the screen size.
If N is specified, it becomes the new default for
subsequent d and u commands.
The entire N lines are displayed, even if N is more than the screen size.
.It Ic u No or Ic \&^U
Scroll backward N lines, default one half of the screen size.
If N is specified, it becomes the new default for
subsequent d and u commands.
The entire N lines are displayed, even if N is more than the screen size.
.It Ic g
Go to line N in the file, default 1 (beginning of file).
.It Ic G
Go to line N in the file, default the end of the file.
.It Ic p No or Ic \&%
Go to a position N percent into the file. N should be between 0
and 100. (This works if standard input is being read, but only if
.Nm
has already read to the end of the file. It is always fast, but
not always useful.)
.It Ic r No or Ic \&^L
Repaint the screen.
.It Ic R
Repaint the screen, discarding any buffered input.
Useful if the file is changing while it is being viewed.
.It Ic m
Followed by any lowercase letter,
marks the current position with that letter.
.It Ic \&'
(Single quote.)
Followed by any lowercase letter, returns to the position which
was previously marked with that letter.
Followed by another single quote, returns to the position at
which the last "large" movement command was executed, or the
beginning of the file if no such movements have occurred.
All marks are lost when a new file is examined.
.It Ic \&/ Ns Ar pattern
Search forward in the file for the N-th line containing the pattern.
N defaults to 1.
The pattern is a POSIX.2
.Dq extended format
regular expression, as described in
.Xr re_format 7 .
The search starts at the second line displayed.
.It Ic \&? Ns Ar pattern
Search backward in the file for the N-th line containing the pattern.
The search starts at the line immediately before the top line displayed.
.It Ic \&/\&! Ns Ar pattern
Like /, but the search is for the N-th line
which does NOT contain the pattern.
.It Ic \&?\&! Ns Ar pattern
Like ?, but the search is for the N-th line
which does NOT contain the pattern.
.It Ic n No and Ic N
Repeat previous search,
in same or opposite direction respectively,
for N-th line containing the last pattern
(or
.Tn NOT
containing the last pattern, if the previous search
was /! or ?!).
.It Ic E Ns Op Ar filename
Examine a new file.
If the filename is missing, the "current" file (see the N and P commands
below) from the list of files in the command line is re-examined.
If the filename is a pound sign (#), the previously examined file is
re-examined.
.It Ic \&:n
Examine the next file (from the list of files given in the command line).
If a number N is specified (not to be confused with the command N),
the N-th next file is examined.
.It Ic \&:p
Examine the previous file.
If a number N is specified, the N-th previous file is examined.
.It Ic \&:t
Go to supplied tag.
.It Ic t
Go forward in tag queue [gtags only].
.It Ic T
Go backward in tag queue [gtags only].
.It Ic v
Invokes an editor to edit the current file being viewed.
The editor is taken from the environment variable
.Ev EDITOR ,
or defaults to
.Xr vi 1 .
.It Ic \&= No or Ic \&^G
These options print out the number of the file currently being displayed
relative to the total number of files there are to display, the current
line number, the current byte number and the total bytes to display, and
what percentage of the file has been displayed. If
.Nm
is reading from stdin, or the file is shorter than a single screen, some
of these items may not be available. Note, all of these items reference
the first byte of the last line displayed on the screen.
.It Xo
.Ic q
.No or
.Ic \&:q
.No or
.Ic ZZ
.Xc
Exits
.Nm more .
.El
.Sh ENVIRONMENT
.Nm More
utilizes the following environment variables, if they exist:
.Bl -tag -width Fl
.It Ev MORE
This variable may be set with favored options to
.Nm more .
.It Ev EDITOR
Specify default editor.
.It Ev SHELL
Current shell in use (normally set by the shell at login time).
.It Ev TERM
Specifies terminal type, used by more to get the terminal
characteristics necessary to manipulate the screen.
.El
.Sh SEE ALSO
.Xr ctags 1 ,
.Xr global 1 ,
.Xr gtags 1 ,
.Xr vi 1
.Sh BUGS
Reading files with long lines is slow.
.Pp
CRLF-terminated 80 character lines are proceeded by an extraneous blank line.
.Pp
Immediate transitions from bold text to underlined text cause the
underlining to be not existing.
.Pp
Sometimes searches match lines that do not contain the pattern being
searched for.
.Pp
The HOME and ARROW keys will only work if you use the correct vt100
escape sequences for them.
.Sh AUTHORS
This software is derived from software contributed to Berkeley
by
.An Mark Nudleman .
.Sh HISTORY
The
.Nm
command appeared in
.Bx 3.0 .