3.24. Printing a File: lpr/lpq/lprmBSD UNIX provided its own print commands, and both sets of commands are supported by Linux. These commands cover the same basic functions of print, check the queue, cancel the job, but have different names and arguments. To print my file using such a system, use the lpr utility, which works as shown in Figure 3-29.
lpr causes a numbered print job to be started for the specified files. You may find the status of a particular job and/or printer by using the lpq utility (Figure 3-30).
If for some reason you wish to cancel a print job, you may do so by using the lprm utility:
You may obtain a list of the printers on your system from your system administrator. As in our previous example, I started by ordering a printout of "heart.final" from the "lwcs" printer. I then decided to order two more copies, and obtained a printer status. Finally, I changed my mind and canceled the last print job. $ lpr -Plwcs heart.final ...order a printout. $ lpq -Plwcs glass ...look at the printer status. lwcs is ready and printing Rank Owner Job Files Total Size active glass 731 heart.final 213 bytes $ lpr -#2 -Plwcs heart.final ...order two more copies. $ lpq -Plwcs glass ...look at the printer status again. lwcs is ready and printing Rank Owner Job Files Total Size active glass 731 heart.final 213 bytes active glass 732 heart.final 426 bytes $ lprm -Plwcs 732 ...remove the last job. centaur: dfA732vanguard dequeued centaur: cfA732vanguard.utdallas.edu dequeued $ _ In the next example, I used the keyboard to compose a quick message for the printer, and requested mail notification of job completion: $ lpr -m -Plwcs ...print from standard input. Hi there, This is a test of the print facility. - Graham ^D ...end of input. $ ...wait a little. $ mail ...read my mail. Mail version 8.1 6/6/93. Type ? for help. >N 1 daemon@utdallas.edu Sat Jan 31 18:04 15/502 printer job & 1 ...read the first mail message. From: daemon@utdallas.edu To: glass@utdallas.edu Subject: printer job Date: Tue, 31 Jan 2005 18:04:32 -0600 Your printer job (stdin) Completed successfully & q ...quit out of mail. $ _ |