pg(1)pg(1)NAMEpg - file perusal filter for soft-copy terminals
SYNOPSIS
number] string] linenumber] pattern] [file ...]
Remarks
and are both used in similar situations (see more(1)). Text highlight‐
ing features supported by are not available from However, has some use‐
ful features not provided by
DESCRIPTION
is a text file filter that allows the examination of files one screen‐
ful at a time on a soft-copy terminal. If is used as a file argument,
or detects NULL arguments in the comand line, the standard input is
used. Each screenful is followed by a prompt. To display a new page,
press Return. Other possibilities are enumerated below.
This command is different from other paginators such as in that it can
back up for reviewing something that has already passed. The method
for doing this is explained below.
In order to determine terminal attributes, scans the data base for the
terminal type specified by the environment variable (see terminfo(4)).
If is not defined, terminal type is assumed.
Options
recognizes the following command line options:
number is an integer specifying the size (in lines) of
the window that is to use instead of the default
(on a terminal containing 24 lines, the default
window size is 23).
Causes to use string as the prompt. If the prompt
string contains a the first occurrence of in the
prompt is replaced by the current page number
when the prompt is issued. The default prompt
string is a colon
Home the cursor and clear the screen before displaying each
page.
This option is ignored if is not defined in the
data base for this terminal type.
Causes to pause at the end of each file.
Normally, splits lines longer than the screen width, but
some sequences of characters in the text being
displayed (such as escape sequences for underlin‐
ing) generate undesirable results. The option
inhibits from splitting lines.
Normally, commands must be terminated by a new-line character.
This option causes an automatic end-of-command as
soon as a command letter is entered.
Restricted mode. The shell escape is disallowed.
will print an error message but does not exit.
Causes to print all messages and prompts in standout
mode (usually inverse video).
Start display at
linenumber.
Start up at the first line
containing text that matches the regular expres‐
sion pattern.
looks in the environment variable to preset any flags desired. For
example, if you prefer to view files using the mode of operation, the
POSIX-shell command sequence or the C-shell command causes all invoca‐
tions of including invocations by programs such as and to use this
mode. The command sequence to set up the environment variable is nor‐
mally placed in the user or file. No form of quoting is provided, so
the string and pattern arguments are limited to single word.
The responses that can be typed when pauses can be divided into three
categories: those causing further perusal, those that search, and those
that modify the perusal environment.
Commands that cause further perusal normally take a preceding address,
an optionally signed number indicating the point from which further
text should be displayed. This address is interpreted either in pages
or lines, depending on the command. A signed address specifies a point
relative to the current page or line; an unsigned address specifies an
address relative to the beginning of the file. Each command has a
default address that is used if none is provided.
Perusal commands and their defaults are as follows:
(+1)<newline> or <blank>
Displays one page. The address is specified in
pages.
With a relative address,
simulates scrolling the screen, forward or back‐
ward, the number of lines specified. With an
absolute address prints a screenful beginning at
the specified line.
Simulates scrolling a half-screen forward or backward.
Skip screens of text.
Same as newline except that
, if present, becomes the new default number of
lines per screenful.
The following perusal commands take no address:
Typing a single period causes the current page of text
to be redisplayed.
Displays the last windowful in the file.
Use with caution when the input is a pipe.
The following commands are available for searching for text patterns in
the text. The Basic Regular Expression syntax (see regexp(5)) is sup‐
ported. The terminal or can be omitted from the pattern search com‐
mands. Regular expressions must always be terminated by a new-line
character, even if the option is specified.
Search forward for the
ith (default i=1) occurrence of pattern. Search‐
ing begins immediately after the current page and
continues to the end of the current file, without
wrap-around.
Search backwards for the
ith (default i=1) occurrence of
pattern. Searching begins immedi‐
ately before the current page and
continues to the beginning of the
current file, without wrap-around.
The notation is useful for Adds 100
terminals which cannot properly
handle the
After searching, normally displays the line found at the
top of the screen. This can be modified by appending or
to the search command to leave the line found in the mid‐
dle or at the bottom of the window from now on. The suf‐
fix can be used to restore the original situation.
users can modify the perusal environment with the follow‐
ing commands:
Begin perusing the
ith next file in the command line.
The i is an unsigned number,
default value is 1.
Begin perusing the
ith previous file in the command
line. i is an unsigned number,
default is 1.
Display another window of text.
If i is present, set the window
size to i.
Save the input in the named file.
Only the current file being perused
is saved. The white space between
the and filename is optional. This
command must always be terminated
by a new-line character, even if
the option is specified.
Help by displaying an abbreviated summary of
available commands.
Quit pg.
command is passed to the shell, whose name
is taken from the environment vari‐
able. If this is not available,
the default shell is used. This
command must always be terminated
by a new-line character, even if
the option is specified.
At any time when the output is being sent to the termi‐
nal, the user can press the quit key (normally CTRL-\),
the interrupt (break) key or the DEL key. This causes to
stop sending output, and display the prompt. The user may
then enter one of the commands in the normal manner.
Unfortunately, some output is lost when this is done, due
to the fact that any characters waiting in the terminal's
output queue are flushed when the quit signal occurs.
If the standard output is not a terminal, is functionally
equivalent to (see cat(1)), except that a header is
printed before each file if more than one file is speci‐
fied.
EXTERNAL INFLUENCES
Environment Variables
determines the collating sequence used in evaluating reg‐
ular expressions.
determines the interpretation of text as single and/or
multi-byte characters, and the characters matched by
character class expressions in regular expressions.
determines the language in which messages are displayed.
If or is not specified in the environment or is set to
the empty string, the value of is used as a default for
each unspecified or empty variable. If is not specified
or is set to the empty string, a default of "C" (see
lang(5)) is used instead of If any internationalization
variable contains an invalid setting, behaves as if all
internationalization variables are set to "C". See envi‐
ron(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
EXAMPLES
To use when reading system news:
WARNINGS
If terminal tabs are not set every eight positions, unde‐
sirable results may occur.
When using as a filter with another command that changes
the terminal I/O options (such as crypt(1)), terminal
settings may not be restored correctly.
While waiting for terminal input, responds to and by ter‐
minating execution. Between prompts, however, these sig‐
nals interrupt pg's current task and place the user in
prompt mode. These should be used with caution when
input is being read from a pipe, because an interrupt is
likely to terminate the other commands in the pipeline.
Users of will find that the and commands are available,
and that the terminal or can be omitted from the pattern
search commands.
FILES
terminal information data base
temporary file when input is from a pipe
SEE ALSOcrypt(1), grep(1), more(1), terminfo(4), environ(5),
lang(5), regexp(5).
STANDARDS CONFORMANCEpg(1)