July 12, 2011, 12:58 p.m.
posted by juff
As far as UNIX is concerned, its only job is to send your file to the printer. Now the real work begins: finding your printout.
Network If your UNIX system is attached to a network, chances are that your printer is attached to some other computer rather than to yours. You may have to go looking for it to find your printouts.
You may have to ask people in nearby cubicles or stand still in the center of the office and listen for the sound of printing (a gentle whir and click from most laser printers). If all else fails, ask your system administrator. Because your UNIX system may be capable of using more than one printer, your system administrator may be the only person who can tell you which printer your printout is on.
Aha! There’s the printer! If you’re lucky, no one else printed anything recently, so the paper on top of the printer is all yours. More likely, lots of people printed stuff, and a pile of paper is on top of the printer — only some of which is yours.
With luck, every printout has in front of it a sheet that identifies the file that’s printed, with the username, time, and other odds and ends that seemed relevant to the person who configured the printer. Rooting through the stack, picking out your own pages, and leaving the rest in a heap is considered tacky. Instead, separate the printouts and leave them on the table or in printout racks (if available) with the usernames visible. With luck, others do the same for you. If you can’t find your printout on the printer, maybe someone else already separated and stacked the printouts. Or maybe other users decided that your printout looked more interesting than theirs and took it off the printer to read it.
A reasonably large installation probably has several printers, either because one printer can’t handle all the work or because the installation uses different kinds of printers. When you use the lp or lpr command, UNIX picks one printer as the default. If you use lp, you use the -d option (that’s a lowercase d — remember that UNIX cares about these things) to identify the printer. To print your file on a printer named draft, for example, you type
lp -ddraft myletter
If you use lpr, the analogous option is -P (that’s an uppercase P), so the command you type is
lpr -Pdraft myletter
In either case, don’t type a space between the -d or -P and the printer name.
The list of available printers depends entirely on the whims of the system administrator. Typically, one day she gets tired of putting up with the slow, illegible, or chronically broken previous printer, storms into the boss’s office, gets the necessary signature, and buys the first printer available. Sometimes the old printer is thrown away, sometimes not.
Getting a list of printers known to the system is generally not too difficult. If you use the lp command to print, type this line to get a list of available printers:
lpstat -a all
This line means roughly, “Show me the status of all printers that are active.” The lpstat program lists the status of all available printers, one per line, like this:
dj accepting requests since Thu Apr 26 13:43:50 2001
In this case, only one printer, whose name is dj, is available. The listing also shows you the vital fact that it was installed on a Thursday afternoon in April 2001. Whoopee.
Linux If you use the lpr command to print, try typing this line to get the same information:
The lpq program responds with a similar list:
lp: Rank Owner Job Files Total Size 1st johnl 7 longletter 4615 bytes ps: no entries
The lpq command stands for something like line printer query, and -a means all printers. In this case, two printers are available, named lp and ps, and something is printing on the first one.
Keep in mind that not every printer the lpstat and lpq commands report to is usable. System administrators frequently put in the table of printers some test entries that don’t really represent printers you can use.