Printing with CUPS, Part 1

Wednesday Jul 9th 2003 by Carla Schroder

Each variant of Unix has its own printing system with its own unique behaviors and shortcomings. Carla Schroder reveals how you can get the most out of a free, extensible, single-solution tool for Unix and Linux that standardizes printing in these environments.

The Common Unix Printing System (CUPS) is a completely new printing subsystem for Linux and Unix that replaces the hoary old Unix line-printer protocols. It runs on Unix, Linux, MacOS, and OS X, and serves clients on nearly any platform, including Windows.

CUPS is thoroughly modern, supporting modern laser and inkjet printers, as well as dot matrix and other legacy printers. It's based on the Internet Printing Protocol (IPP), which is an extension of the HyperText Transport Protocol. IPP enables printing locally, or to any networked printer anywhere, no matter how wide your LAN/WAN is. It supports access controls, authentication, quotas, directory services, and encryption.

In this two-part series we'll look at print serving with CUPS on Linux. CUPS can be administered from the command line, from its own browser-based interface, or from a number of third-party graphical front-ends. Two good front-ends to consider are Kprinter and XPP. Kprinter is especially thorough, incorporating nearly all of CUPS' commands and features in a well-organized interface.

CUPS is abundantly documented; most commands have a man page, and the CUPS Software User and CUPS Software Administrator manuals are available online (see http://localhost:631/documentation.html or visit An additional useful resource is the book "CUPS: Common Unix Printing System," by Michael Sweet, one of the primary authors of CUPS.

KDEPrint and are a couple of indispensable resources for printing in Linux. has done a wonderful job compiling a huge database of printers and drivers, as well as rating printers for Linux compatibility.

Page 2: Printer Drivers

Printer Drivers

Printer drivers in CUPS consist of one or more filters specific to a printer, which are packaged as PPD (PostScript Printer Description) files. All printers in CUPS need one – even non-PostScript printers. PPDs contain descriptions about the printers, specific printer commands, and filters.

The heart and soul of CUPS are filters. Filters translate print jobs to formats the printer can understand, such as PDF, HP-PCL, raster, and image files. Filters pass in commands such as page selection and ordering. PPDs are text files – take a look in /usr/share/cups/model/ to see what they look like. Installed printers have PPDs in /etc/cups/ppd.

Included in CUPS are generic PPDs for 9-pin and 24-pin Epson dot matrix printers, Epson Stylus Color, Stylus Photo, HP LaserJet, HP DeskJet, and even Dymo label printers. These will work for hundreds of printers, although they may not support all printer functions, such as duplexing and tray selection.

Finding drivers for printers can get confusing, as there are many sources to peruse: printer manufacturers, CUPS, Gimp-Print, ESP, random developers, etc. Save your sanity and start with what ships with CUPS. If these drivers aren't too your satisfaction, visit Gimp-Print drivers are high-quality – I prefer them.

Note that printer drivers for CUPS cannot just be copied over; rather, they must first go through a PPD-file generation process before CUPS can use them. Again, refer to, which has instructions and web-based utilities to handle the job.

Commercial Option

Easy Software Products, the maintainer and developer of CUPS, distributes the tool in two versions: a free of cost (under the GPL) edition and the commercial ESP Print Pro. ESP Print Pro costs $49 for the single, standalone Linux version and $249 for a server with unlimited clients. Various pricing plans are also available for enterprise users.

The commercial version comes with many more printer drivers as well as technical support. The commercial version is worth considering to get support, better drivers, or for unusual or higher-end printers.

Page 3: Installation


Most modern Linux distributions should come with CUPS already installed. CUPS is designed to be adaptable and extensible, so the various distributions take advantage of this and customize it — some rather heavily. The commands remain the same, but file locations may be all goobered up; don't yell at me if files aren't where I say they are.

It is best to have the latest version. Look in the title bar of the CUPS browser to see the installed version. The current stable version is 1.1.19. If this version is not installed on your system, please see Resources. Also be sure to remove any installed printer systems before installing CUPS.

Here's how to tell if the CUPS daemon, cupsd, is running:

$ lpstat -t
scheduler is running
system default destination: HPLaserJet
members of class test:

The -t switch acts like all the lpstat switches combined, giving complete status information.

Starting and stopping cupsd depends on how your system handles init scripts. The executable should be /usr/sbin/cupsd. In Debian:

# /etc/init.d/cupsys {start|stop|restart|force-reload}

Red Hat 8.0 uses /sbin/service cups {}, Gentoo /etc/init.d/cups {} – well, you get the idea – see the docs for your distribution. By default CUPS should start itself at boot; the restart command is needed only after making changes to the configuration files (/etc/cups/cupsd.conf or /etc/cups/client.conf).

Page 4: Standalone Linux PC with Attached Printer

Standalone Linux PC with Attached Printer

Run lpinfo to see a list of supported devices on your system:

lpinfo -v

network socket
network http
network ipp
network lpd
direct canon:/dev/lp0
direct epson:/dev/lp0
direct parallel:/dev/lp0
direct scsi
serial serial:/dev/ttyS0?baud=115200
direct usb:/dev/usb/lp0
direct usb:/dev/usb/lp1
network smb

OK, this is good – we can use any kind of physical printer connection. I have an old HP LaserJet 6L, the Unkillable Printer – this old thing just keeps on working. (Note: There is a free fix for some HP printers that develop paper feed problems, such as feeding too many pages; see here.)

This command installs the printer:

# /usr/sbin/lpadmin -p HPLaserJet -L powerpc -E -v parallel:/dev/lp0 -m laserjet.ppd

lpadmin -p sets the printer name. This can be anything (do not have duplicates, though).
-L sets the printer location. Again, this can be anything – make it something useful that tells where the printer is or what it is attached to.
-E enables the printer and makes it ready to receive jobs.
-v sets the deviceURI, which comes from lpinfo.
-m sets either an interface script or a PPD file, or it defines the "drivers."

Note that switches must be hyphenated individually; they cannot be combined.

While that was fun, installing printers via the CUPS browser-based interface, http://localhost:631/admin, tends to be a bit more enjoyable (although it is good to understand the lpadmin commands). The installation menus are self-explanatory. When you get to the menu for selecting the driver, I recommend choosing the Gimp-Print driver, if one is available.

An easy and interesting exercise is to install your local printer with different drivers (if more than one is available), then print and compare the test pages. (Be sure to delete each driver before installing a new one; don't try to install multiple drivers for the same printer.)

For PPD files obtained elsewhere, such as, see the handy-dandy PPD file tester – test 'em before trying to use 'em.

Notice how the CUPS Web interface stays synchronized with the command line. It might take a refresh or two, but it's possible to switch back and forth and not worry about conflicts.

In Part 2 we'll explore using CUPS with networked printers, including network-direct, and Windows servers and clients.


Easy Software Products
PPD file tester

» See All Articles by Columnist Carla Schroder

Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved