Printing Stuff: Daemons at Work

Printing Stuff: Daemons at Work

From a human being’s point of view, printing stuff in UNIX is simplicity itself: You use either the lp command or the lpr command, depending on your flavor of UNIX. Many office suite packages have built-in printing commands, but they’re all lp or lpr underneath.

From your computer’s point of view, this arrangement is, of course, way too simple. To make things suitably complex, the print command doesn’t print the file. What it does is leave a note for another program buried deep inside UNIX, and this buried program prints your file. This buried program is called a daemon (pronounced “demon”). The theory behind this arrangement is that a bunch of people may want to use the printer, and waiting for the printer to be free is a pain. The print command puts your file on a list, and the daemon runs down the list and does the printing so that you don’t have to wait. The request ID is the name the print command gives to the note it leaves for the daemon. You can ignore the request ID unless you change your mind and decide that you don’t want to print that file after all.

Printing in System V

If you use UNIX System V, you print stuff with the lp command. If you have a file named myletter, for example, you print it by typing this line:

lp myletter

UNIX responds with this important information:

request id is dj-2613 (1 file)

Usually, that’s all you need to do. UNIX responds to your request to print by telling you the request ID of the print job, which you probably don’t care about. Sometimes you want to pretty up the way the printout looks by leaving wider margins; we talk about that subject later in this chapter.

Printing in BSD and Linux

 Linux  If you use Linux or BSD UNIX, printing is just as easy as printing with System V, except that you use the command lpr rather than lp. If you have a file named myletter, for example, you print it by typing

lpr myletter

Some systems, notably SVR4 and Solaris, have both the lp and lpr commands. If you have these versions of UNIX, either command works equally well. Note that the lpr command doesn’t report a request ID.

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows