Previous Next Contents

5. How it works, basic

In order to get printing working well, you need to understand how the lpd system works.

Lpd stands for Line Printer Daemon, and refers in different contexts to both the daemon and the whole collection of programs which run print spooling. These are:

lpd

The spooling daemon. One of these runs to control everything on a machine, AND one is run per printer while the printer is printing.

lpr

The user spooling command. Lpr contacts lpd and injects a new print job into the spool.

lpq

Lists the jobs in a print queue.

lpc

The Lpd system control command. With lpc you can stop, start, reorder, etc, the print queues.

lprm

lprm will remove a job from the print spool.

So how does it fit together? Well, when the system boots, lpd is run. It scans the file /etc/printcap to learn which printers it will be managing spools for. Each time someone runs lpr, lpr contacts lpd through the named socket /dev/printer, and feeds lpd both the file to print and some information about who is printing and how to print it. Lpd then prints the file on the appropriate printer in turn.

The lp system was originally designed when most printers were line printers - that is, people mostly printed plain ascii. As it turns out, only a little extra scripting is needed to make lpd work quite well for today's print jobs, which are often in PostScript, or text, or dvi, or...


Previous Next Contents