Prepare a file for printing

The pr command prepares a text file for printing in Linux. By default, pr adds headers that include the filename, date and time, and the page number. For example, consider the following output of the pr command:

linux pr command

In the picture above you can see that the pr command added the current date and time, the filename and the page number.

We can modify the output of the pr command in a number of ways. For example, we might want to change the header to display some other text, instead of the filename. We can do this using the -h option:

linux pr command change header

We can set the page length using the -l option, which sets the length of the page in lines:

linux pr command change page length

Subscribe to our Newsletter

Like us on Facebook

Geek University 2019