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