]> git.ipfire.org Git - thirdparty/util-linux.git/blame - text-utils/pg.1
po: merge changes
[thirdparty/util-linux.git] / text-utils / pg.1
CommitLineData
3a60b1c2 1.\" Copyright 2001 Gunnar Ritter
07990fdc 2.TH PG 1 "July 2014" "util-linux" "User Commands"
63cccae4
KZ
3.SH NAME
4pg \- browse pagewise through text files
5.SH SYNOPSIS
6.B pg
07990fdc 7.RB [ \-\fIamount\fP ]
30a07f7e 8.RB [ \-p
07990fdc 9.IR prompt ]
30a07f7e
PB
10.RB [ \-cefnrs ]
11.RB [ +\fIline\fP ]
12.RB [ +/\fIpattern\fP/ ]
13.RI [ file ...]
63cccae4 14.SH DESCRIPTION
232dc924 15.B pg
63cccae4
KZ
16displays a text file on a
17.SM CRT
18one screenful at once.
b63f3814 19After each page, a prompt is displayed. The user may then either press the
63cccae4
KZ
20newline key to view the next page or one of the keys described below.
21.PP
22If no filename is given on the command line,
b63f3814 23.B pg
63cccae4 24reads from standard input.
b63f3814
BS
25If standard output is not a terminal,
26.B pg
63cccae4 27acts like
42632a90 28.BR cat (1)
63cccae4
KZ
29but precedes each file with its name if there is more than one.
30.PP
31If input comes from a pipe,
b63f3814 32.B pg
07990fdc 33stores the data in a buffer file while reading,
63cccae4
KZ
34to make navigation possible.
35.SH OPTIONS
b63f3814 36.B pg
63cccae4
KZ
37accepts the following options:
38.TP
5bdc3754 39.BI + number
07990fdc 40Start at the given line number.
5bdc3754
JA
41.TP
42.BI +/ pattern /
43Start at the line containing the Basic Regular Expression
44.I pattern
45given.
46.TP
63cccae4 47.BI \- number
07990fdc 48The number of lines per page. By default, this is the number of
63cccae4 49.SM CRT
b63f3814 50lines minus one.
63cccae4
KZ
51.TP
52.B \-c
b63f3814 53Clear the screen before a page is displayed,
63cccae4
KZ
54if the terminfo entry for the terminal provides this capability.
55.TP
56.B \-e
b63f3814 57Do not pause and display
63cccae4
KZ
58.SM (EOF)
59at the end of a file.
60.TP
61.B \-f
b63f3814 62Do not split long lines.
63cccae4
KZ
63.TP
64.B \-n
b63f3814
BS
65Without this option, commands must be terminated by a newline character.
66With this option,
67.B pg
63cccae4
KZ
68advances once a command letter is entered.
69.TP
70.BI \-p \ string
b63f3814
BS
71Instead of the normal prompt
72.IR : ,
63cccae4
KZ
73.I string
74is displayed.
75If
76.I string
77contains
07990fdc 78.BR %d ,
b63f3814 79its first occurrence is replaced by the number of the current page.
63cccae4
KZ
80.TP
81.B \-r
82Disallow the shell escape.
83.TP
84.B \-s
85Print messages in
86.I standout
b63f3814 87mode,
63cccae4
KZ
88if the terminfo entry for the terminal provides this capability.
89.TP
07990fdc 90.BR \-V , " \-\-version"
d35df4db 91Display version information and exit.
07990fdc
BS
92.TP
93.BR \-h , " \-\-help"
94Display help text and exit.
95.SH COMMANDS
b63f3814 96The following commands may be entered at the prompt. Commands preceded by
63cccae4
KZ
97.I i
98in this document accept a number as argument, positive or negative.
99If this argument starts with
07990fdc 100.B +
63cccae4 101or
07990fdc 102.BR \- ,
63cccae4
KZ
103it is interpreted relative to the current position in the input file,
104otherwise relative to the beginning.
105.TP
07990fdc 106.IB i <Enter>
63cccae4
KZ
107Display the next or the indicated page.
108.TP
109\fIi\fR\fBd\fR or \fB^D\fR
b63f3814 110Display the next halfpage. If
63cccae4
KZ
111.I i
112is given, it is always interpreted relative to the current position.
113.TP
114.IB i l
115Display the next or the indicated line.
116.TP
117.IB i f
118Skip a page forward.
119.I i
120must be a positive number and is always interpreted relative
121to the current position.
122.TP
123\fIi\fR\fBw\fR or \fIi\fR\fBz\fR
07990fdc
BS
124As
125.B <Enter>
30a07f7e 126except that
63cccae4
KZ
127.I i
128becomes the new page size.
129.TP
130.BR . " or " ^L
131Redraw the screen.
132.TP
133.B $
134Advance to the last line of the input file.
135.TP
136.IB i / pattern /
137Search forward until the first or the \fIi\fR-th
30a07f7e 138occurrence of the Basic Regular Expression
63cccae4 139.I pattern
b63f3814
BS
140is found. The search starts
141after the current page and stops at the end of the file.
142No wrap-around is performed.
63cccae4
KZ
143.I i
144must be a positive number.
145.TP
146\fIi\fR\fB?\fR\fIpattern\fR\fB?\fR or \fIi\fR\fB^\fR\fIpattern\fR\fB^\fR
147Search backward until the first or the \fIi\fR-th
48d7b13a 148occurrence of the Basic Regular Expression
63cccae4 149.I pattern
b63f3814 150is found. The search starts
63cccae4 151before the current page and stops at the beginning of the file.
30a07f7e 152No wrap-around is performed.
63cccae4
KZ
153.I i
154must be a positive number.
155.PP
b63f3814 156The search commands accept an added letter. If
63cccae4
KZ
157.B t
158is given, the line containing the pattern is displayed at the top of the
159screen, which is the default.
160.B m
161selects the middle and
162.B b
163the bottom of the screen.
164The selected position is used in following searches, too.
165.TP
166.IB i n
167Advance to the next file or
168.I i
169files forward.
170.TP
171.IB i p
172Reread the previous file or
173.I i
174files backward.
175.TP
176.BI s \ filename
177Save the current file to the given
178.I filename.
179.TP
180.B h
181Display a command summary.
182.TP
183.BI ! command
184Execute
185.I command
186using the shell.
187.TP
188.BR q " or " Q
189Quit.
190.PP
191If the user presses the interrupt or quit key while
b63f3814 192.B pg
63cccae4
KZ
193reads from the
194input file or writes on the terminal,
b63f3814 195.B pg
63cccae4
KZ
196will immediately display the prompt.
197In all other situations these keys will terminate
b63f3814 198.BR pg .
63cccae4
KZ
199.SH "ENVIRONMENT VARIABLES"
200The following environment variables
ee312c65 201affect the behavior of
b63f3814 202.BR pg :
63cccae4
KZ
203.TP
204.B COLUMNS
205Overrides the system-supplied number of columns if set.
206.TP
207.BR LANG ,\ LC_ALL ,\ LC_COLLATE ,\ LC_CTYPE ,\ LC_MESSAGES
208See
42632a90 209.BR locale (7).
63cccae4
KZ
210.TP
211.B LINES
212Overrides the system-supplied number of lines if set.
213.TP
214.B SHELL
215Used by the
b63f3814 216.BR ! " command."
63cccae4
KZ
217.TP
218.B TERM
219Determines the terminal type.
220.SH "SEE ALSO"
221.BR cat (1),
222.BR more (1),
223.BR sh (1),
224.BR terminfo (5),
225.BR locale (7),
226.BR regex (7),
227.BR term (7)
228.SH NOTES
b63f3814
BS
229.B pg
230expects the terminal tabulators to be set every eight positions.
63cccae4
KZ
231.PP
232Files that include
233.SM NUL
234characters cannot be displayed by
b63f3814 235.BR pg .
86d62711 236.SH AVAILABILITY
601d12fb 237The pg command is part of the util-linux package and is available from
d673b74e 238https://www.kernel.org/pub/linux/utils/util-linux/.