3.23. Printing a File: lp/lpstat/cancelNow that the hard work is done, I want to obtain a printout of my lyrics to sing from. I can use the GNU utility, patterned after the System V UNIX utility, called lp (Figure 3-26).
lp 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 lpstat utility (Figure 3-27).
If for some reason you wish to cancel a print job, you may do so by using the cancel utility (Figure 3-28). You will need the request ID displayed by lpstat.
You may obtain a list of the printers on your system from your system administrator. In the following 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. $ lp -d lwcs heart.final ...order a printout. request id is lwcs-37 (1 file) $ lpstat lwcs ...look at the printer status. printer queue for lwcs lwcs-36 ables priority 0 Mar 18 17:02 on lwcs inventory.txt 457 bytes lwcs-37 glass priority 0 Mar 18 17:04 on lwcs heart.final 213 bytes $ lp -n 2 -d lwcs heart.final ...order two more copies. request id is lwcs-38 (1 file) $ lpstat lwcs ...look at the printer status again. printer queue for lwcs lwcs-37 glass priority 0 Mar 18 17:04 on lwcs heart.final 213 bytes lwcs-38 glass priority 0 Mar 18 17:05 on lwcs heart.final 2 copies 213 bytes $ cancel lwcs-38 ...remove the last job. request "lwcs-38" cancelled $ _ In the next example, I used the keyboard to compose a quick message for the printer: $ lp -d lwcs ...print from standard input. Hi there, This is a test of the print facility. - Graham ^D ...end of input. request id is lwcs-42 (standard input) $ _ |