summaryrefslogtreecommitdiffstats
path: root/text-utils/pg.1
blob: 901ac7d91f328b0e8c610da2aed80d849b93a813 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
.\" 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 <Enter>
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 <Enter>
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 VARIABLES"
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 "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
.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 AVAILABILITY
The pg command is part of the util-linux package and is available from
https://www.kernel.org/pub/linux/utils/util-linux/.