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
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
.
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.
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.
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.
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
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.