lpadmin
Configure CUPS printers and classes
TLDR
Set the default printer
Delete a specific printer or class
Add a printer to a class
Remove a printer from a class
SYNOPSIS
lpadmin [ -E ] [ -U username ] [ -h hostname[:port] ] [ -R remove-options ] options
Common usage patterns:
lpadmin -p printer [ -P filename.ppd ] [ -v device-uri ] [ -m model ] [ -D description ] [ -L location ] [ -o option=value ... ]
lpadmin -x printer|class
lpadmin -d printer
lpadmin -c class { printer ... }
PARAMETERS
-p printer
Specifies the name of the printer to add or modify.
-x printer|class
Deletes the specified printer or printer class.
-d printer
Sets the specified printer as the system default destination.
-c class { printer ... }
Adds the specified printers to a class or creates a new class. Multiple printer names can be provided.
-v device-uri
Sets the device Uniform Resource Identifier (URI) for the printer, defining how it's connected (e.g., usb://, ipp://, socket://).
-P filename.ppd
Specifies the PostScript Printer Description (PPD) file for the printer, defining its capabilities.
-m model
Uses a pre-installed CUPS model (PPD file) for the printer. List available models with 'lpinfo -m'.
-D description
Provides a short, descriptive string for the printer, often displayed in print dialogs.
-L location
Specifies the physical location of the printer, useful for organization.
-o option=value
Sets a specific printer option or attribute. Can be used multiple times for different options (e.g., 'printer-is-shared=true', 'job-hold-until=indefinite').
-a
Enables the printer to accept new jobs.
-e
Enables the printer for printing, allowing it to process jobs.
-s
Enables sharing and browsing of the printer, making it visible to other systems on the network.
-u allow/deny:user,...
Controls user access to the printer. Specifies a comma-separated list of users or groups allowed or denied access.
-E
Forces encryption when connecting to the CUPS server, enhancing security.
-U username
Specifies an alternate username for authentication with the CUPS server.
-h hostname[:port]
Specifies an alternate CUPS server to connect to, useful for remote administration.
-R remove-options
Removes specific options from the printer.
DESCRIPTION
lpadmin is a powerful command-line utility for managing and configuring printer queues and classes within the Common Unix Printing System (CUPS). It serves as the primary administrative tool for system administrators to perform a wide range of tasks, including adding new printers, deleting existing ones, modifying printer settings, setting default print destinations, enabling or disabling printer queues, and managing printer classes. It plays a crucial role in setting up both local and network-attached printers, allowing fine-grained control over printing behavior, access, and options. Its consistent interface simplifies complex printer management tasks on Unix-like operating systems.
CAVEATS
lpadmin requires administrative privileges, typically root or membership in the 'lpadmin' group (as configured in CUPS), to modify CUPS configuration. Changes made by lpadmin are usually immediate but depend on the CUPS daemon being active and properly configured. Incorrectly specified device URIs or PPD files can prevent a printer from functioning correctly or exhibiting its full capabilities.
PERMISSIONS
To use lpadmin to configure printers, you typically need to be the root user or a member of the 'lpadmin' or 'sys' group, as defined in the CUPS configuration (usually in /etc/cups/cups-files.conf). This ensures that only authorized users can modify system-wide printer settings, maintaining system security.
DEVICE URIS
The device-uri parameter (used with the -v option) is critical for specifying how the printer is connected to the system or network. Examples include usb://... for USB printers, ipp://hostname/ipp/print for IPP printers, lpd://hostname/queue for LPD/LPR printers, and socket://hostname:9100 for raw network connections. Understanding the correct URI format for your printer's connection type is essential for successful printer setup.
PPD FILES
PPD (PostScript Printer Description) files, specified with the -P option, are text files that describe the capabilities and features of a specific printer model. They are crucial for CUPS to correctly interpret and render print jobs, allowing access to printer-specific options like paper sizes, duplexing capabilities, color modes, and resolution settings. Using the correct PPD ensures optimal printer functionality and access to all its features.
HISTORY
lpadmin is an integral part of the Common Unix Printing System (CUPS), originally developed by Easy Software Products and later acquired by Apple Inc. CUPS was designed to provide a modular and extensible printing system for Unix-like operating systems, aiming to replace older, less standardized printing solutions. lpadmin emerged as the primary command-line tool for administering CUPS queues, offering a unified and consistent interface for managing printers, classes, and their options. Its development has focused on adapting to evolving printing technologies and providing comprehensive control over the CUPS printing architecture.