summaryrefslogtreecommitdiffstats
path: root/text-utils/pg.1
blob: 1a91b1dbb5f1930e168d226b7bc7518a0771ee29 (plain)
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
'\" t
.\"     Title: pg
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.20
.\"      Date: 2024-01-31
.\"    Manual: User Commands
.\"    Source: util-linux 2.40
.\"  Language: English
.\"
.TH "PG" "1" "2024-01-31" "util\-linux 2.40" "User Commands"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
pg \- browse pagewise through text files
.SH "SYNOPSIS"
.sp
\fBpg\fP \fB\-*\fIamount\fP *\-p\fP \fIprompt\fP \fB\-cefnrs\fP +line +/pattern/ file_ ...
.SH "DESCRIPTION"
.sp
\fBpg\fP displays a text file on a 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.
.sp
If no filename is given on the command line, \fBpg\fP reads from standard input. If standard output is not a terminal, \fBpg\fP acts like \fBcat\fP(1) but precedes each file with its name if there is more than one.
.sp
If input comes from a pipe, \fBpg\fP stores the data in a buffer file while reading, to make navigation possible.
.SH "OPTIONS"
.sp
\fBpg\fP accepts the following options:
.sp
\fB+\fP\fInumber\fP
.RS 4
Start at the given line number.
.RE
.sp
\fB+/\fP\fIpattern\fP*/*
.RS 4
Start at the line containing the Basic Regular Expression \fIpattern\fP given.
.RE
.sp
\fB\-\fP\fInumber\fP
.RS 4
The number of lines per page. By default, this is the number of CRT lines minus one.
.RE
.sp
\fB\-c\fP
.RS 4
Clear the screen before a page is displayed, if the terminfo entry for the terminal provides this capability.
.RE
.sp
\fB\-e\fP
.RS 4
Do not pause and display \fI(EOF)\fP at the end of a file.
.RE
.sp
\fB\-f\fP
.RS 4
Do not split long lines.
.RE
.sp
\fB\-n\fP
.RS 4
Without this option, commands must be terminated by a newline character.
.sp
With this option, \fBpg\fP advances once a command letter is entered.
.RE
.sp
\fB\-p\fP \fIstring\fP
.RS 4
Instead of the normal prompt \fI:\fP, \fIstring\fP is displayed. If \fIstring\fP contains \fB%d\fP, its first occurrence is replaced by the number of the current page.
.RE
.sp
\fB\-r\fP
.RS 4
Disallow the shell escape.
.RE
.sp
\fB\-s\fP
.RS 4
Print messages in \fIstandout\fP mode, if the terminfo entry for the terminal provides this capability.
.RE
.sp
\fB\-h\fP, \fB\-\-help\fP
.RS 4
Display help text and exit.
.RE
.sp
\fB\-V\fP, \fB\-\-version\fP
.RS 4
Print version and exit.
.RE
.SH "COMMANDS"
.sp
The following commands may be entered at the prompt. Commands preceded by \fIi\fP in this document accept a number as argument, positive or negative. If this argument starts with \fB+\fP or \fB\-\fP, it is interpreted relative to the current position in the input file, otherwise relative to the beginning.
.sp
\fIi\fP\fB<Enter>\fP
.RS 4
Display the next or the indicated page.
.RE
.sp
\fIi\fP\fBd\fP or \fB^D\fP
.RS 4
Display the next halfpage. If \fIi\fP is given, it is always interpreted relative to the current position.
.RE
.sp
\fIi\fP\fBl\fP
.RS 4
Display the next or the indicated line.
.RE
.sp
\fIi\fP\fBf\fP
.RS 4
Skip a page forward. \fIi\fP must be a positive number and is always interpreted relative to the current position.
.RE
.sp
\fIi\fP\fBw\fP or \fIi\fP\fBz\fP
.RS 4
As \fB<Enter>\fP except that \fIi\fP becomes the new page size.
.RE
.sp
\fB.\fP or \fB^L\fP
.RS 4
Redraw the screen.
.RE
.sp
\fB$\fP
.RS 4
Advance to the last line of the input file.
.RE
.sp
\fIi\fP\fB/\fP\fIpattern\fP\fB/\fP
.RS 4
Search forward until the first or the \fIi\fP\-th occurrence of the Basic Regular Expression \fIpattern\fP is found. The search starts after the current page and stops at the end of the file. No wrap\-around is performed. \fIi\fP must be a positive number.
.RE
.sp
\fIi\fP\fB?\fP\fIpattern\fP\fB?\fP or \fIi\fP\fB\fP\fIpattern\fP\fB\fP
.RS 4
Search backward until the first or the \fIi\fP\-th occurrence of the Basic Regular Expression \fIpattern\fP is found. The search starts before the current page and stops at the beginning of the file. No wrap\-around is performed. \fIi\fP must be a positive number.
.RE
.sp
The search commands accept an added letter. If \fBt\fP is given, the line containing the pattern is displayed at the top of the screen, which is the default. \fBm\fP selects the middle and \fBb\fP the bottom of the screen. The selected position is used in following searches, too.
.sp
\fIi\fP\fBn\fP
.RS 4
Advance to the next file or \fIi\fP files forward.
.RE
.sp
\fIi\fP\fBp\fP
.RS 4
Reread the previous file or \fIi\fP files backward.
.RE
.sp
\fBs\fP \fIfilename\fP
.RS 4
Save the current file to the given \fIfilename\fP.
.RE
.sp
\fBh\fP
.RS 4
Display a command summary.
.RE
.sp
\fB!\fP\fIcommand\fP
.RS 4
Execute \fIcommand\fP using the shell.
.RE
.sp
\fBq\fP or \fBQ\fP
.RS 4
Quit.
.RE
.sp
If the user presses the interrupt or quit key while \fBpg\fP reads from the input file or writes on the terminal, \fBpg\fP will immediately display the prompt. In all other situations these keys will terminate \fBpg\fP.
.SH "ENVIRONMENT"
.sp
The following environment variables affect the behavior of \fBpg\fP:
.sp
\fBCOLUMNS\fP
.RS 4
Overrides the system\-supplied number of columns if set.
.RE
.sp
\fBLANG\fP, \fBLC_ALL\fP, \fBLC_COLLATE\fP, \fBLC_CTYPE\fP, \fBLC_MESSAGES\fP
.RS 4
See \fBlocale\fP(7).
.RE
.sp
\fBLINES\fP
.RS 4
Overrides the system\-supplied number of lines if set.
.RE
.sp
\fBSHELL\fP
.RS 4
Used by the \fB!\fP command.
.RE
.sp
\fBTERM\fP
.RS 4
Determines the terminal type.
.RE
.SH "NOTES"
.sp
\fBpg\fP expects the terminal tabulators to be set every eight positions.
.sp
Files that include NUL characters cannot be displayed by \fBpg\fP.
.SH "SEE ALSO"
.sp
\fBcat\fP(1),
\fBmore\fP(1),
\fBsh\fP(1p),
\fBterminfo\fP(5),
\fBlocale\fP(7),
\fBregex\fP(7),
\fBterm\fP(7)
.SH "REPORTING BUGS"
.sp
For bug reports, use the issue tracker at \c
.URL "https://github.com/util\-linux/util\-linux/issues" "" "."
.SH "AVAILABILITY"
.sp
The \fBpg\fP command is part of the util\-linux package which can be downloaded from \c
.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."