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