The Common Unix Printing System (CUPS)
The Common UNIX Printing System, or CUPS, is a comprehensive network based print system for Linux and other UNIX based operating system. CUPS supports printing to all Postscript based printers, and provides an interface to print to non Postscript printers.
Print Jobs
A print job is a document that is submitted for printing. When a user prints a document, the document gets formatted into a format that the printer understands. This formatted document becomes a print job, and is submitted to CUPS for processing. CUPS will handle the details of submitting the job to the physical printer. Each job is assigned a number, which can be used to reference the job with the command line tools.
Printers and Print Queues
Before CUPS can print, printer details must be configured. A single physical printer may be configured up on several different computers running CUPS (although typically it would only be configured on one computer) . The configuration specifies the printer type, how it is connected (i.e. locally or over the network), which driver to use, who can access it etc. The configuration also assigns a name to the configuration which is used to refer to the printer. The computer that contains the printer configuration information also allocates space for a print queue, which is used to store print jobs that are waiting to be sent to the printer.
Once a printer is configured on one computer, other computers on the network may use the configuration to send jobs to the printer.
How It Works
CUPS services are provided by the cupsd daemon, which must be running on any Linux box that wishes to print. The cupsd daemon handles all aspects of the print process including printer sharing, drivers, access control, and submitting print jobs to remote print queues.
Consider the diagram. It described a network that contains several printers. Let's examine how CUPS manages print jobs destined to the various printers on the network.

- A print job is created on Alpha destined for the printer named Frodo. Frodo is physically connected to Alpha, so CUPS will send the job directly to the printer via its local USB connection.
- A print job is created on Alpha destined for the printer named Gimli. Gimli is physically connected to Beta. The CUPS server on Alpha will send the job to the CUPS server on Beta, which will then send the job directly to the printer via USB. If the printer cannot handle the job immediately, the job will be queued on Beta until the printer can handle the job.
- A print job is created on Alpha destined for the printer named Gandalf. Gandalf refers to an HP LaserJet printer that can accept print jobs directly over the network. The Alpha CUPS server will send the job directly to the HP LaserJet printer. If the job cannot be sent to the printer immediately, it will be queued on Alpha until the printer can handle the job.
- A print job is created on Alpha destined for the printer named Elrond. Notice that Elrond and Gandalf both point to the same physical network printer. Alpha will send the print job to Beta, which will then send the job to the printer over the network to the HP LaserJet. If the job cannot be sent to the printer immediately, it will be queued on Beta until the printer can handle the job.
CUPS Features
Some of the features that CUPS supports are:
- Support for local (Parallel, Serial and USB), and network printers supporting the following
protocols:
- Internet Printing Protocol (IPP) - This is a new HTTP based protocol and is the preferred one to use with CUPS. Some new networked printers now support it.
- Line Printer Daemon (LPD) - For Unix/Linux compatibility
- Server Message Blocks (SMB) - This allows compatibility with printers shared from a Microsoft Windows computer
- AppSocket ( a.k.a. JetDirect)
- Printer administration and print jobs can be controlled by command line tools, or through a web based interface. Some distributions also provide their own graphical CUPS configuration tools.
- An auto discovery capability that allows CUPS software to automatically detect printers that are set up on the network. These printers can be used by any CUPS enabled system without any additional configuration required. Note: This feature is turned off by default in RedHat based distributions.
- Access to printers can be controlled based on network addresses, or user authentication.
- If there are many print jobs submitted at once, or if the printer is unavailable for any reason (i.e. due to a paper jam, low toner, or any other reason), CUPS will queue the print job, and submit the job to the printer when it becomes available again.
- The ability to create collections of printers known as a class. A print job sent to a class will be sent to the first available printer in the class. This feature comes in handy in organizations that make heavy use of printers as it allows users to print documents and not worry if the printer is able to respond immediately. A printer may be tied up printing a large print job, or may have a paper jam, or any other problem. If one printer is down, CUPS can simple redirect the print job to another printer in the class that can print the document faster.
Printing
Print jobs can be submitted by applications, or via the command line. Most applications have a similar printing interface to that used by Microsoft Windows. Typically printing from an application is as simple as selecting Print from a menu.
Print jobs can be submitted and managed from the command line as well. The following commands are used for this purpose:
Submitting Print Jobs:
lp [options] file_name
Command to submit print jobs from the command line.
The -d option specifies the printer name. If a printer name is not specified, CUPS will
use the default printer. The -n num option specifies how many copies to print.
Print job control:
cancel job_id
Used to remove jobs from the queue. Replace job_id with the job id to cancel.
Setting The Default Printer
lpoptions -d printername
Sets printer options. The -d option specifies the printer name to be set as default.
CUPS also provides a comprehensive web based interface for printer configuration and
management. The interface can be accessed by pointing your web browser to:
http://localhost:631 or http://yourIP:631
More Information
For more information on CUPS, consult the official CUPS website at www.cups.org.