On Unix-like operating systems, the pr command formats a file to make it look better when printed.
This page covers the GNU/Linux version of pr.
Description
pr paginates or columnates FILE(s) for printing.
- Description
- Syntax
- Examples
- Related commands
- Linux commands help
The -t option is implied if PAGE_LENGTH is less than or equal to 10.
If no FILE is specified, or when FILE is a dash ("-"), pr reads from standard input instead.
Mandatory arguments to long options are mandatory for short options as well:
Syntax
pr [OPTION]… [FILE]…
Options
Examples
ls -a | pr -n -h “Files in $(pwd)” > directory.txt
Fetch a listing of all files in the current directory using the ls command, and pipe the output to pr, which formats the data in a printer-friendly format with a custom header and numbered lines. The formatted pr output is written to the file directory.txt, which can then be printed.
Related commands
expand — Expand tab characters to several spaces.lp — Print a file on the System V operating system.