Manual / pr
pr(1)
| PR(1) | General Commands Manual | PR(1) |
NAME
pr - paginate files for printing
SYNOPSIS
pr [ +page ] [ -column ] [ -adFmt ] [ -e[char][gap] ] [ -i[char][gap] ] [ -h header ] [ -l lines ] [ -n[char][width] ] [ -o offset ] [ -s[char] ] [ -w width ] [ file ...]
DESCRIPTION
Pr writes each file (standard input if none is given) to standard output, broken into pages: a 5-line header (date, the file's name or -h's header, and a page number), the file's own lines, and enough trailing blank lines to fill the page — even the LAST page of a short file is padded out to the full page length. Multiple file operands each start their own page numbering at 1 and name themselves in their own header; with no operand, the header names no file at all.
The header's date is the file's own last-modification time (or the current time, for standard input) — never the time pr itself ran.
OPTIONS
- -t
- Write neither header nor trailer, and never break the output into pages at all — every line is copied straight through.
- -l lines
- Set the page length (default 66). At most lines -10 lines of file content appear on any one page. A lines too small to leave room for even one content line under a header falls back to the -t shape (matching this tree's own oracle host, measured live).
- -h header
- Replace the file's own name in the header with header.
- -n[char][width]
- Number each line of file content, right-justified in a field width characters wide (default 5), followed by char (default a tab). Both are optional and, if given, must be ATTACHED to the option (-n:3, not -n :3).
- -d
- Double-space the file's content lines.
- -o offset
- Indent every output line, header included, by offset spaces.
- +page
- Skip every page before page, without affecting its own page numbering — the file is still read in full.
- -column
- Write column text columns per page, filled DOWN each column in turn (the default 1 is the plain layout). A page holds lines -10 rows (the page length itself under -t); the last, short page is as short as it can be, left columns first. Columns are as wide as (width - (column - 1)) / column (default width 72) and a longer line is TRUNCATED to that, the last column included. Spaces between columns are written as tabs, as under -i. A page of columns that does not fit in memory (more than 1024 lines, or a text arena of roughly 38 KB) is refused with a message and exit status 1; nothing is ever written short.
- -a
- With -column, fill each row across before starting the next.
- -m
- Merge: one column per file, read in lockstep. At most five real files (a process has eight file descriptors and three are standard input, output and error); a sixth is refused before anything is read. A - operand is standard input and takes no descriptor. A file that has run out leaves its cell empty and the others keep their columns. The header names no file. Not with -column.
- -s[char]
- Separate columns with char (default tab) instead of padding. The default width becomes 512.
- -w width
- Line width for columns (default 72). Without -s at most 254: column positions are kept in 8 bits.
- -e[char][gap]
- Expand input tabs (or char) to every gap th column (default 8) before the line is cut into columns.
- -i[char][gap]
- Write runs of two or more spaces as tabs (or char) at every gap th column (default 8); a lone space stays a space and spaces at the end of a line are dropped. Assumed for more than one column.
- -F
- Page boundaries are a form feed in place of the blank padding lines. No effect under -t.
FILES
/usr/man/PR this page
SEE ALSO
DIAGNOSTICS
Exit status is 0 on success, 1 if a file could not be opened or a limit above was exceeded, 2 for a usage error.
BUGS
A short last page of columns is filled left first (4, 4, 2 for ten lines in three), as BSD does; GNU balances (4, 3, 3). Under -n every column cell is numbered; BSD and GNU lay the number out differently from each other and from this. A file's modification date is real wall-clock time, so two runs of the same command print different headers by design.
| October 8, 2026 | maux |