Linux Commands - pr (format file for printing)

The pr command is intended to format a file for printing. For example, let's say the file named foo.txt has the following content.

Hello World
How are you today?


The PR command has a number of options to format the file. -n numbers the list, and -h adds a header named "Greetings".

pr -n -h "Greetings" foo.txt > bar.txt


Before printing, you may want to use the lpstat or lpc commands to list the available printers.

There are a few different commands that can be used to sent print jobs to the printer.

  • lp (Line print)
  • lpr (Line print request)
  • lpd (Line print daemon)

The lpq command can be used to view and cancel print jobs in the print queue. The lprm command can be used to remove print jobs.

Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter e5c51 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |