the printer description file, or “printer capabilities” database
the spool directories (there may be more than one)
this file specifies the minimum free space to leave on the partition containing /var
actual line printer devices
the socket for local requests
lists hosts that are allowed printer access
lists hosts that are allowed printer access, but are administered by hosts other than this print server
the users file
the line printer daemons (services)
the directories to be used for spooling
To add a print queue to lpd, you must add an entry in /etc/printcap, and create a new spool directory under /var/spool/lpd.
An entry in /etc/printcap looks like this:
# LOCAL djet850 #A comment line for humans
lp|dj|deskjet:\ #Three names for this printer, any of which will be accepted
:sd=/var/spool/lpd/dj:\ #The spooler directory
:mx#0:\ #Maximum print job size: 0 means no max
:lp=/dev/lp0:\ #The device that will print these jobs
:sh: #No cover sheet
LPD is the actual printer daemon.
- It starts at boot time,
- reads the printcap file to find what printers are specified, and
- prints any files left over if the system crashed.
Then it calls (commands):
- listen (for print requests), and
- accept (to transfer files to the spool, display the queue, or remove jobs).
LPD is multi-threaded.
- Remember that threads run in system space, while processes run in user space.
- When LPD gets a print job, it forks a child thread to run it.
- The parent thread continues listening for requests.
Unlike LPD, which is a daemon, lpr is a command. Its format is:
lpr /path/to/file [arguments]
Common arguments are:
#There must be no space between -P and the queue name. This forces output to a specific printer.
#Suppress header page
#Where to send an email with confirmation
#Number of copies
#Title for cover page, if used
Note the interesting fact that if no file is specified, standard input will be printed!
Like lpr, lpq is a command. It’s used to list print jobs in the queue. It lists:
- user’s name
- the print job’s position in the queue
- the file(s) to be printed
- the job’s numeric ID
- the size of the job in bytes
Check a specific printer by using the -P option:
Notice that once again there is no space between -P and the printer name. If no printer is specified, the default printer is assumed. A user name or job number may be specified after the -P parameter, to restrict reporting to just that user or job.
The lpc (Line Printer Controller) command looks like this:
Depending on the subcommand, lpc lets the administrator:
- disable or enable a queue,
- reorder jobs in a queue,
- check a printer’s status, or
- (with no subcommand) go to an lpc> prompt for an interactive session.
#To terminate current and subsequent printing. Also useful if the spooler is hung: issue abort followed by start.
#Completely stop the specified print queue.
#Same as disable, but it also logs a message to the printer status file. Subsequent print job attempts return the status message.
#Turns a spool back on.
#Terminates an interactive session.
#Tells LPD to reread its config file.
#Enables printing and starts spooler for the printer(s) named as arguments to this command.
#Stops LPD and disables printing.
topq [printer] [jobs]
#Lets you send specific jobs to the top of the queue for the specified printer.
#Enables the queue for that printer and starts a new print daemon for that queue.
This command removes print jobs from a spool queue. The default printer is assumed unless you specify one:
#Stops the default spool queue
#Stops jobs for djet850
#Stops all your print jobs; stops ALL print jobs if issued by root (or su).
#Stops job 15
#Stops all print jobs for this user