Linux and Unix pg command

Quick links

About pg
Syntax
Commands
Examples
Related commands
Linux and Unix main page

About pg

Files perusal filters for CRTs.

Syntax

pg [-number] [-p string] [-c] [-e] [-f] [-n] [-r][-s] [+ linenumber] [+/ pattern /] [filename]

-number An integer specifying the size (in lines) of the window that pg is to use instead of the default. (On a terminal containing 24 lines, the default window size is 23).
-p string pg uses string as the prompt. If the prompt string contains a %d, the first occurrence of %d in the prompt will be replaced by the current page number when the prompt is issued. The default prompt string is ``:''.
-c Home the cursor and clear the screen before displaying each page. This option is ignored if clear_screen is not defined for this terminal type in the terminfo(4) data base.
-e pg does not pause at the end of each file.
-f Normally, pg splits lines longer than the screen width, but some sequences of characters in the text being displayed (for instance, escape sequences for underlining) generate undesirable results. The -f option inhibits pg from splitting lines.
-n Normally, commands must be terminated by a <new line> character. This option causes an automatic end of command as soon as a command letter is entered
-r Restricted mode. The shell escape is disallowed. pg prints an error message but does not exit.
-s pg prints all messages and prompts in the standard output mode (usually inverse video).
+linenumber Start up at linenumber.
|/pattern/ Start up at the first line containing the regular expression pattern.
filename A path name of a text file to be displayed. If no filename is given, or if it is -, the standard
input is read.

Commands

h help
q or Q quit
<blank> or <newline> next page
l next line
d or <^D> display half a page more
. or <^L> redisplay current page
f skip the next page forward
n next file
p previous file
$ last page
w or z set window size and display next page
s savefile save current file in savefile
/pattern/ search forward for pattern
?pattern? or ^pattern^ search backward for pattern
!command execute command

Examples

pg myfile.txt

Execute and display the file myfile.txt.

Related commands

cat
grep
more