CUPS is a printing system used on many different Linux distributions. Its use is very widespread, as it has become the standard print manager on the majority of popular Linux distros. It acts as a print spooler, scheduler, print job manager, and can store information for numerous local or network printers.

In this guide, we'll introduce you to CUPS on Linux, with basic information like commands, accessing its web interface, default port, how to add a printer, testing, and starting and stopping the service. Various systems may implement CUPS differently or put their own spin on it, but CUPS works mostly the same on any distro and these instructions will likely apply to any system that utilizes CUPS.

In this tutorial you will learn:
  • How to use the CUPS web interface
  • How to add a printer in CUPS
  • Various CUPS commands
  • How to control the CUPS service
An introduction to CUPS on Linux
An introduction to CUPS on Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro with CUPS
Software CUPS
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

CUPS web interface

Most users will wish to interact with CUPS through its provided web interface. The web interface runs on port 631, thus it can be accessed through any browser by navigating to http://localhost:631.

CUPS web interface on Linux
CUPS web interface on Linux

In the web control panel, you can add or delete printers, install drivers, access the print spooler, and configure various settings for all the printers accessible from your PC. Most or all of the options you'll need to interact with can be found in the "Administration" section.

Administration section inside the CUPS web control panel
Administration section inside the CUPS web control panel

SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


Add a printer in CUPS

You can add a printer through CUPS by going to the "Administration" section as described above, then clicking "Add printer." If there are any network printers discovered, they'll be listed here. Otherwise, you can choose to add an "HP printer" which is more of a catch-all for any type of hardwired printer, and not specifically HP manufactured printers.

Adding a printer to our Linux system through CUPS
Adding a printer to our Linux system through CUPS

If you're sure there is a printer on the network that hasn't been automatically discovered and listed here, just choose the appropriate network protocol and click through to the next menu to add it via its network address.

CUPS commands

CUPS can be used from the Linux command line to print files, see available printers, and even configure lots of different printing options. The following is not an exhaustive list of commands, but they're enough to get an idea for how CUPS works on the command line.

To print a file, use the lp command followed by the file you wish to print. CUPS can interpret most types of files, including text, PDF, images, etc.

$ lp filename

CUPS will attempt to send this print job to your default printer. You can specify a particular printer with -P:

$ lp -P printer filename

Or, to change your default printer, use the lpoptions command:

$ lpoptions -d printer

You can specify various options for your print job with the -o option. Pass as many options as you'd like.

$ lp -o landscape -o fit-to-page -o media=A4 filename.jpg


A full list of options and other commands can be found in the help section of the web control panel.

The Help section of CUPS shows a long list of commands and options that can be used
The Help section of CUPS shows a long list of commands and options that can be used

Controlling the CUPS service

If you're experiencing problems with CUPS, it can be helpful to restart the service. Controlling the process can be done with systemctl commands on Linux distros with systemd.

To start, stop, or restart CUPS:

$ sudo systemctl start cups
$ sudo systemctl stop cups
$ sudo systemctl restart cups

To check on the status of CUPS, and enable or disable it from starting automatically upon system boot:

$ systemctl status cups
$ sudo systemctl enable cups
$ sudo systemctl disable cups
Status of the CUPS service, displayed with systemctl command
Status of the CUPS service, displayed with systemctl command

Conclusion

In this guide, we learned about CUPS, the Linux print manager. We saw how to use it to add printers to our system and control the print spooler. We also saw how to access CUPS from the command line, and systemctl commands which provide us with basic troubleshooting options.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions