| .\" @(#)pg.1 1.7 (gritter) 4/25/01 |
| .TH PG 1 "2001-04-25" "Gunnar Ritter" "User Commands" |
| .SH NAME |
| pg \- browse pagewise through text files |
| .SH SYNOPSIS |
| .B pg |
| .RB [ \-\fInumber\fP ] |
| .RB [ \-p |
| .IR string ] |
| .RB [ \-cefnrs ] |
| .RB [ +\fIline\fP ] |
| .RB [ +/\fIpattern\fP/ ] |
| .RI [ file ...] |
| .SH DESCRIPTION |
| .I 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, |
| .I pg |
| reads from standard input. |
| If the standard output is not a terminal, |
| .I pg |
| acts like |
| .IR cat (1) |
| but precedes each file with its name if there is more than one. |
| .PP |
| If input comes from a pipe, |
| .I pg |
| stores the data in a buffer file while reading |
| to make navigation possible. |
| .SH OPTIONS |
| .I Pg |
| accepts the following options: |
| .TP |
| .BI \- number |
| The number of lines per page. Usually, 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 |
| .I pg |
| will not pause and display |
| .SM (EOF) |
| at the end of a file. |
| .TP |
| .B \-f |
| .I pg |
| does not split long lines. |
| .TP |
| .B \-n |
| Without this option, commands must be terminated by a newline character. With |
| this option, |
| .I pg |
| advances once a command letter is entered. |
| .TP |
| .BI \-p \ string |
| Instead of the prompt |
| .I " :" |
| , |
| .I string |
| is displayed. |
| If |
| .I string |
| contains |
| .I %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 |
| .BI + number |
| Start at the given line. |
| .TP |
| .BI +/ pattern / |
| Start at the line containing the Basic Regular Expression |
| .I pattern |
| given. |
| .SH USAGE |
| 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 |
| .I + |
| or |
| .I \-, |
| it is interpreted relative to the current position in the input file, |
| otherwise relative to the beginning. |
| .TP |
| .IB i <newline> |
| 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 |
| Behave as |
| .I <newline> |
| 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 |
| .I pg |
| reads from the |
| input file or writes on the terminal, |
| .I pg |
| will immediately display the prompt. |
| In all other situations these keys will terminate |
| .I pg. |
| .SH "ENVIRONMENT VARIABLES" |
| The following environment variables |
| affect the behaviour of |
| .I 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 |
| .IR locale (7). |
| .TP |
| .B LINES |
| Overrides the system-supplied number of lines if set. |
| .TP |
| .B SHELL |
| Used by the |
| .B ! |
| command. |
| .TP |
| .B TERM |
| Determines the terminal type. |
| .SH "SEE ALSO" |
| .BR cat (1), |
| .BR more (1), |
| .BR sh (1), |
| .BR terminfo (5), |
| .BR locale (7), |
| .BR regex (7), |
| .BR term (7) |
| .SH NOTES |
| .I pg |
| expects the terminal tabulators to set on eight positions. |
| .PP |
| Files that include |
| .SM NUL |
| characters cannot be displayed by |
| .IR pg . |
| .SH AVAILABILITY |
| The pg command is part of the util-linux-ng package and is available from |
| ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. |