Printing a file on a Linux system can use the pr command, and pr is a shorthand for print. However, it is best to use the command to do some processing on the file before printing. This article will introduce the Linux system to use the command to print the file.
If you want to print text files, it is best to handle it in advance, including adjusting margins, line height settings, set the title, etc., so print out documents more attractive and easy to read. Of course, you can print without processing, but it may be ugly.
Most Linux comes with two powerful text formatting tools, nroff and troff, but they are relatively old and use very few people. Interested readers can learn by themselves. This tutorial is no longer available. In-depth explanation.
First, pr command
The pr command is used to convert a text file into a format suitable for printing. It can divide a large file into multiple pages for printing, and for each page. Add a title.
The syntax of the pr command is as follows:
pr option(s) filename(s)
The pr command simply changes the display style and printout style of the file on the screen, and The file itself will not be changed. The following table shows several options for the pr command:
Option Description
-k Prints in several columns, defaulting to 1.
-d Double line spacing (not all versions of pr are valid).
-h “header” Set the title of each page.
-t Do not print the title and top and bottom margins.
-l PAGE_LENGTH How many rows are displayed per page. The default is a total of 66 lines per page, with 56 lines of text.
-o MARGIN The number of spaces indented per line.
-w PAGE_WIDTH When multi-column output, set the page width, the default is 72 characters.
For example, the food file contains a lot of food names, printed in two columns using the pr command, and set the title of each page to “Restaurants”.
First check the contents of the file:
$cat food
Sweet Tooth
Bangkok Wok
Mandalay
Afghani Cuisine
Isle of Java
Big Apple Deli
Sushi and Sashimi
Tio Pepe‘s Peppers
..... ...
$
Then print using the pr command:
$pr -2 -h “Restaurants” food
Nov 7 9:58 1997 Restaurants Page 1
Sweet Tooth Isle of Java
Bangkok Wok Big Apple Deli
Mandalay Sushi and Sashimi
Afghani Cuisine Tio Pepe’s Peppers< Br>
........
$ Previous123Next page Total 3 pages
I believe that many people have no habit of backing up their computers. In fact, th
In the process of using Linux, we sometimes encounter the exhaustion of swap memory
In the CentOS system, you need to log in when you log in to SSH. In fact, as long a
As a qualified Linux system administrator, it is necessary to constantly monitor th
How to configure and install Node.js in Ubuntu development environment
What are the SELinux security mechanisms?
CentOS sets the three skills of system time
How to configure dynamic IP service for Linux system
How to modify the Linux desktop resolution
How to run the compiler with root privileges under Linux?
Teach you how to install Nessus software in Kali Linux
Linux uses awk to implement multi-line merge instances
CentOS telnet exit failure solution
Methods for Enhancing Linux System Security
Linux using shell scripts to measure high-speed network traffic
Linux system how to use the mount command and software to mount the ISO file
Win7/Win8.1 system upgrade Win10 official version has been flashing how to solve
WP8.1 system WiFi sensing function so service
Remote monitoring software operating principle of gray pigeons
U disk installation GhostWin10 system graphic tutorial
Waiting for the culprit - the boot entry you are neglecting
Open the graphic tutorial of win8 sliding shutdown function
There must be at least one new version before the official version of Windows 10
Win10 defines a solution to the black background problem on the desktop background.
Set up FTP Server-Windows Server 2012
Win7 system security lossless adjustment partition size detailed tutorial