.\" Copyright 2001 Gunnar Ritter .TH PG 1 "July 2014" "util-linux" "User Commands" .SH NAME pg \- browse pagewise through text files .SH SYNOPSIS .B pg .RB [ \-\fIamount\fP ] .RB [ \-p .IR prompt ] .RB [ \-cefnrs ] .RB [ +\fIline\fP ] .RB [ +/\fIpattern\fP/ ] .RI [ file ...] .SH DESCRIPTION .B pg displays a text file on a .SM CRT one screenful at once. After each page, a prompt is displayed. The user may then either press the newline key to view the next page or one of the keys described below. .PP If no filename is given on the command line, .B pg reads from standard input. If standard output is not a terminal, .B pg acts like .BR cat (1) but precedes each file with its name if there is more than one. .PP If input comes from a pipe, .B pg stores the data in a buffer file while reading, to make navigation possible. .SH OPTIONS .B pg accepts the following options: .TP .BI + number Start at the given line number. .TP .BI +/ pattern / Start at the line containing the Basic Regular Expression .I pattern given. .TP .BI \- number The number of lines per page. By default, this is the number of .SM CRT lines minus one. .TP .B \-c Clear the screen before a page is displayed, if the terminfo entry for the terminal provides this capability. .TP .B \-e Do not pause and display .SM (EOF) at the end of a file. .TP .B \-f Do not split long lines. .TP .B \-n Without this option, commands must be terminated by a newline character. With this option, .B pg advances once a command letter is entered. .TP .BI \-p \ string Instead of the normal prompt .IR : , .I string is displayed. If .I string contains .BR %d , its first occurrence is replaced by the number of the current page. .TP .B \-r Disallow the shell escape. .TP .B \-s Print messages in .I standout mode, if the terminfo entry for the terminal provides this capability. .TP .BR \-V , " \-\-version" Display version information and exit. .TP .BR \-h , " \-\-help" Display help text and exit. .SH COMMANDS The following commands may be entered at the prompt. Commands preceded by .I i in this document accept a number as argument, positive or negative. If this argument starts with .B + or .BR \- , it is interpreted relative to the current position in the input file, otherwise relative to the beginning. .TP .IB i Display the next or the indicated page. .TP \fIi\fR\fBd\fR or \fB^D\fR Display the next halfpage. If .I i is given, it is always interpreted relative to the current position. .TP .IB i l Display the next or the indicated line. .TP .IB i f Skip a page forward. .I i must be a positive number and is always interpreted relative to the current position. .TP \fIi\fR\fBw\fR or \fIi\fR\fBz\fR As .B except that .I i becomes the new page size. .TP .BR . " or " ^L Redraw the screen. .TP .B $ Advance to the last line of the input file. .TP .IB i / pattern / Search forward until the first or the \fIi\fR-th occurrence of the Basic Regular Expression .I pattern is found. The search starts after the current page and stops at the end of the file. No wrap-around is performed. .I i must be a positive number. .TP \fIi\fR\fB?\fR\fIpattern\fR\fB?\fR or \fIi\fR\fB^\fR\fIpattern\fR\fB^\fR Search backward until the first or the \fIi\fR-th occurrence of the Basic Regular Expression .I pattern is found. The search starts before the current page and stops at the beginning of the file. No wrap-around is performed. .I i must be a positive number. .PP The search commands accept an added letter. If .B t is given, the line containing the pattern is displayed at the top of the screen, which is the default. .B m selects the middle and .B b the bottom of the screen. The selected position is used in following searches, too. .TP .IB i n Advance to the next file or .I i files forward. .TP .IB i p Reread the previous file or .I i files backward. .TP .BI s \ filename Save the current file to the given .I filename. .TP .B h Display a command summary. .TP .BI ! command Execute .I command using the shell. .TP .BR q " or " Q Quit. .PP If the user presses the interrupt or quit key while .B pg reads from the input file or writes on the terminal, .B pg will immediately display the prompt. In all other situations these keys will terminate .BR pg . .SH ENVIRONMENT The following environment variables affect the behavior of .BR pg : .TP .B COLUMNS Overrides the system-supplied number of columns if set. .TP .BR LANG ,\ LC_ALL ,\ LC_COLLATE ,\ LC_CTYPE ,\ LC_MESSAGES See .BR locale (7). .TP .B LINES Overrides the system-supplied number of lines if set. .TP .B SHELL Used by the .BR ! " command." .TP .B TERM Determines the terminal type. .SH NOTES .B pg expects the terminal tabulators to be set every eight positions. .PP Files that include .SM NUL characters cannot be displayed by .BR pg . .SH SEE ALSO .BR cat (1), .BR more (1), .BR sh (1p), .BR terminfo (5), .BR locale (7), .BR regex (7), .BR term (7) .SH AVAILABILITY The pg command is part of the util-linux package and is available from https://www.kernel.org/pub/linux/utils/util-linux/.