
lpadmin Command in Linux
CUPS offers various commands to set up printers and make them available on the network. It also has options specific to each printer that allows you to manage printer settings. One of these commands, lpadmin, is used to configure printer and class queues in CUPS. You can also use it to set a default printer or class for the server.
In this tutorial, we'll explore the lpadmin command and its practical use cases to manage printer and class settings.
Table of Contents
Here is a comprehensive guide to the options available with the lpadmin command −
- What is lpadmin Command in Linux?
- Syntax of lpadmin Command
- lpadmin Command Options
- lpadmin Command Manual Page
- lpadmin Command Help Page
- Examples of lpadmin Command in Linux
What is lpadmin Command in Linux?
lpadmin is a command-line utility in Linux that allows us to manage printer and class settings. We can use this command to set up new printers, adjust existing configurations, and remove printers as needed. This command is commonly used by network administrators and advanced users who want to configure printer settings from the command line.
Syntax of lpadmin Command
We can run the lpadmin command in a Linux environment with the following syntax. This syntax sets the specified printer as the default destination −
lpadmin [ -E ] [-U username ] [ -h server[:port] ] -d destination
You can use the following syntax to configure or modify the printer with specified options and settings −
lpadmin [ -E ] [-U username ] [ -h server[:port] ] -p destination [ -R name-default ] option(s)
Execute the syntax below to remove the specified printer from the list of available printers −
lpadmin [ -E ] [-U username ] [ -h server[:port] ] -x destination
lpadmin Command Options
The lpadmin command supports several options to configure the printers. Here are some commonly used options for this command −
Options | Description |
---|---|
-c class | Adds the specified printer to a class and creates a class if it doesn’t exist. |
-o cupsIPPSupplies=true/false | Controls IPP supply level reporting. |
-i interface | Uses a System V interface script for legacy printer support (not compatible with -P). |
-m model | Selects a standard model or PPD file for the printer. Run lpinfo -m to list models. |
-o job-k-limit=value | Sets a kilobyte limit for per-user print quotas. |
-o job-page-limit=value | Limits the number of pages per user. |
-o job-quota-period=value | Defines the time period for per-user quotas in seconds. |
-o job-sheets-default=banner | Sets default banner page(s) for print jobs. |
-o name=value | Sets a specific PPD option for the printer. |
-o name-default=value | Configures a default option on the server, such as -o cpi-default=17 |
-o port-monitor=name | Sets a port monitor, either "none", "bcp", or "tbcp", for print communication. |
-o printer-error-policy=name | Specifies the action for print errors (e.g., "stop-printer" or "retry-job"). |
-o printer-is-shared=true/false | Shares or unshares the printer on the network. |
-o printer-op-policy=name | Sets the IPP policy for the printer; defaults are in cupsd.conf. |
-R name-default | Removes a specified option from the printer. |
-r class | Removes a printer from a class, deleting the class if empty. |
-u allow:user,user,@group -u deny:user,user,@group -u allow:all -u deny:none |
Sets access control for specific users or groups. |
-v "device-uri" | Defines the printer's device URI. Use lpinfo -v to see available URIs. |
-D "info" | Adds a description of the printer. |
-E | Enables the printer and allows it to accept jobs. |
-L "location" | Specifies the printer's physical location. |
-P ppd-file | Uses a specific PPD file, overriding the -i option if set. |
lpadmin Command Manual Page
Run the following command for an indepth overview of the lpadmin command −
man lpadmin

lpadmin Command Help Page
Run the lpadmin command with the --help option to check the lpadmin command usage concisely −
lpadmin --help

Setting Up a Printer with the lpadmin Command
To set up a printer using lpadmin, specify the printer name, device URI, and PPD file, enable it for active use, and optionally set it as the default printer.
Examples of lpadmin Command in Linux
Now go through the following examples for a profound understanding of the Linux lpadmin command −
Adding a Printer Using lpadmin
Let's run the command below to add a printer using the lpadmin command −
lpadmin -p Printer_Name -E -v usb://HP/Printer_Model -D "Office Printer" -L "Room 101" -m everywhere
This command sets up and configures a printer by assigning it a name with the -p option, enabling secure connections with the -E option, specifying the device URI using -v, and adding useful details like a description and location using the -D and -L options. If no specific PPD file is available, the "-m everywhere" option uses a generic driver to ensure compatibility.
Adding a Network Printer Using lpadmin
You can use the lpadmin command to add a network printer available at socket://192.168.1.50 −
lpadmin -p NetworkPrinter -E -v socket://192.168.1.50 -D "Network Printer" -L "IT Department" -m everywhere
Setting Default Printer Options for lpadmin
We use the lpadmin command with the -o option to set default options for a printer, such as setting duplex mode −
lpadmin -p Printer_Name -o Duplex=DuplexNoTumble
This command ensures that the printer prints on both sides of the paper without flipping.
Removing a Printer using lpadmin
We can run the lpadmin command with the -x option to delete a specific printer −
lpadmin -x printer_name
This command removes the specified printer from the list of available printers.
Setting a Printer as the Default using the lpadmin
Use the -d option with the lpadmin command to set a printer as the system-wide default printer −
lpadmin -d Printer_Name
Now, all print jobs that don't have a designated printer will be sent to Printer_Name.
Conclusion
The lpadmin command is a command line tool for managing printer settings in CUPS. It allows users to configure printers, set default options, and maintain accessibility on the network.
In this tutorial, we have covered the basic syntax, common options, and practical examples of using lpadmin to add, modify, and remove printers. Whether you're a network administrator or an advanced user, lpadmin can enhance your control over printer management in Linux systems.