In the office, you often print some files. But in the office system is Linux, how can I print files in the Linux system? This section describes how to configure a printer in a Linux system so that you can print it easily in the office. I hope you can learn how to configure a printer in a Linux system.
In Linux, The spooling printing method is used. When you need to print a file, the file is not directly sent to the printer, but to the spool directory, A background process responsible for printing then sends the data to the printer. Linux defines a print buffer for each printer. The printer daemon often scans the print buffer to check whether new files are to be printed. If it exists, print the files in the buffer in the FIFO order. In addition to printing on a local printer, Linux can also print data remotely through a network printer.
Command Used for Printing
Linux provides a set of printing commands. In general, the print command uses the default PRINTER. If the user defines the PRINTER environment variable, the print command uses the PRINTER defined by this variable. In addition, you can also specify the printer to use on the command line.
Lpr command
The lpr command is an offline printing command that stores the print job in the print Buffer Queue. Each printer specified for the Linux system has its own print buffer directory, and the minfree file in each directory specifies the number of disk blocks that store the print files.
Lpr communicates with the lpd daemon. lpd scans the/etc/printcap file, queries the cache directory of the printer, controls the printing by lpd, and sends the data to the actual printer. If no file is specified, lpr uses the standard input.
The format of the lpr command is:
Lpr [-P printer] [# num] [other options] [name…]
The meanings of the options in the command are as follows:
-P specifies the printer. If this option is not used, use the PRINTER specified by the default PRINTER or environment variable PRINTER.
-Send an email after m is printed.
-# Print num copies.
Lpq command
Lpq is a Buffer Queue check command. It checks print files in the buffer zone through lpd and reports the status of a specified job or all jobs of a specified user. The lpq command without any parameters shows any job in the queue. An important information in the display result of The lpq command is the job ID, which identifies a specific job. If you want to cancel a suspended job, you must specify this ID number in the command.
The format of the lpq command is:
Lpq [-l] [-P printer] [job #] [user…]
The meanings of the options in the command are as follows:
-P specifies a PRINTER; otherwise, use the PRINTER specified by the default PRINTER or environment variable PRINTER.
-L print the information of all the files that constitute the job.
For each submitted job, The lpq report username, the level in the queue, the file that makes up the job, the job ID, and the total size.
Lprm command
The lprm command is used to delete a print job from the Buffer Queue. You can use this command to delete one or more of your print jobs from the buffer queue.
The format of the lprm command is:
Lprm [-P printer] [-] [job #] [user…]
The meanings of the options in the command are as follows:
-P specifies a PRINTER; otherwise, use the PRINTER specified by the default PRINTER or environment variable PRINTER.
-Delete all print jobs of the user.
Delete jobs belonging to user in the user queue (only super users can do this ).
Job # by specifying the job number # deleting a print job, the job number can be obtained through the lpq command, such:
- $ lpq –l
- lst:ken [job #013ucbarpa]
- (standard input) 100 bytes
- $ lprm 13
Print buffer directory
For printing, there is a very important directory, that is, the print buffer directory. The data to be printed is concentrated here before being printed. A printer usually corresponds to a print buffer Directory, which makes it easier to manage the printer. For example, the system uses/var/spool/lpd as the primary print buffer, and each printer has a directory with the same name under the primary print buffer. Therefore, the printer named ps_nff uses/var/spool/lpd/ps_nff as its print buffer directory.
Complete printer configuration in Linux and print it quickly.
- Describes how to create a log server in Linux and vro.
- Linux practical command-pv: MPS queue Viewer
- Compile dtAgeiaPhysX in 64-bit Linux
- Battle: Linux Desktop Mint 8 and Windows 7
- Simple Theory Linux ReiserFS system analysis features and results