CUPS / Printing
Notes for checking, creating, modifying, deleting, and troubleshooting CUPS printers on Linux/RHEL systems.
CUPS stands for Common UNIX Printing System. It manages printers, print queues, print jobs, printer access, and printer-related services.
Use this page when:
a printer is not working
a print queue is stuck
jobs are not printing
a printer queue needs to be created
a printer queue needs to be deleted
CUPS service has issues
printer network connectivity needs checking
printer settings (tray, page size, etc.) need to be changed
Important safety rule
Before changing printer settings, ask:
1. Am I on the correct server?
2. Is this production or test?
3. Which printer or queue is affected?
4. Is this one user, one printer, or all printers?
5. Am I only checking status, or changing/removing jobs?
6. Will this affect active users or print jobs?
7. Do I have approval to create, delete, disable, or restart anything?
Be careful with:
deleting printer queues
canceling all jobs
disabling queues
rejecting jobs
restarting CUPS
editing CUPS config files
changing default printer settings
Main CUPS service
CUPS service name is usually:
cups
or:
cups.service
Check CUPS service status
systemctl status cups
Alternative older command:
service cups status
Start CUPS
sudo systemctl start cups
Restart CUPS
sudo systemctl restart cups
Use carefully on shared print servers because this can affect active print jobs.
Enable CUPS at boot
sudo systemctl enable cups
CUPS logs
Check CUPS logs with journalctl
journalctl -u cups
Show latest logs:
journalctl -u cups -n 100
Follow logs live:
journalctl -u cups -f
Common CUPS log location
Depending on the system, logs may also be in:
/var/log/cups/
Check:
ls -lah /var/log/cups/
Common files:
access_log
error_log
page_log
View latest errors:
sudo tail -n 100 /var/log/cups/error_log
Follow live:
sudo tail -f /var/log/cups/error_log
Printer and queue checks
List printers
lpstat -p
List printers and full status
lpstat -t
This is one of the best first commands.
It can show:
scheduler status
default printer
printer status
queue status
print jobs
Show default printer
lpstat -d
Show available destinations
lpstat -e
Show printer details
lpstat -l -p PRINTER_NAME
Show printer device URI
Show one printer:
lpstat -v PRINTER_NAME
Show all printer device URIs:
lpstat -v
Create, modify, and delete printers
Use these commands carefully. Creating, changing, or deleting printer queues can affect users.
Modern CUPS/RHEL prefers driverless IPP printing where possible.
Use raw/socket/PPD-based queues only when required by the environment or printer model.
Create a printer queue
The main command is:
sudo lpadmin
Basic structure:
sudo lpadmin -p PRINTER_NAME -E -v DEVICE_URI -m DRIVER_OR_MODEL
Example:
sudo lpadmin -p <PRINTERNAME> -E -v beh:/1/0/60/socket://x.xx.xxx.xx:9100
sudo lpadmin -p <PRINTERNAME> -E -v socket://x.xx.xxx.xx:9100
Meaning:
-p = printer queue name
-E = enable printer and accept jobs
-v = device URI / printer connection
-m = printer driver/model
Preferred: create IPP Everywhere / driverless printer
Use this when the printer supports IPP Everywhere or driverless printing.
sudo lpadmin -p PRINTER_NAME -E -v ipp://PRINTER_HOSTNAME/ipp/print -m everywhere
Example:
sudo lpadmin -p office_printer -E -v ipp://printer01.example.com/ipp/print -m everywhere
Encrypted IPP example:
sudo lpadmin -p office_printer -E -v ipps://printer01.example.com/ipp/print -m everywhere
Verify:
lpstat -t
lpstat -v PRINTER_NAME
AppSocket / JetDirect printer
AppSocket / JetDirect commonly uses port 9100.
Use this only when required by the printer or environment.
Example with a PPD file:
sudo lpadmin -p PRINTER_NAME -E -v socket://PRINTER_IP:9100 -P /path/to/printer.ppd
Example:
sudo lpadmin -p office_socket -E -v socket://192.0.2.50:9100 -P /tmp/printer.ppd
If your company uses raw queues or a special print server standard, follow the internal standard.
Do not assume this works everywhere:
sudo lpadmin -p PRINTER_NAME -E -v socket://PRINTER_IP:9100 -m everywhere
Use -m everywhere mainly with IPP Everywhere / driverless printing unless your environment has confirmed otherwise.
Create printer with a PPD file
If a specific PPD file is required:
sudo lpadmin -p PRINTER_NAME -E -v DEVICE_URI -P /path/to/file.ppd
Example:
sudo lpadmin -p office_printer -E -v socket://192.0.2.50:9100 -P /tmp/printer.ppd
Set default printer
sudo lpadmin -d PRINTER_NAME
Check default printer:
lpstat -d
Enable printer and accept jobs
After creating a printer, make sure it is enabled and accepting jobs:
sudo cupsenable PRINTER_NAME
sudo cupsaccept PRINTER_NAME
Verify:
lpstat -t
Disable printer queue
This stops the printer queue from printing jobs.
sudo cupsdisable PRINTER_NAME
Reject new jobs
This prevents new jobs from being submitted to the printer.
sudo cupsreject PRINTER_NAME
Add a reason:
sudo cupsreject PRINTER_NAME -r "Printer under maintenance"
Accept jobs again
sudo cupsaccept PRINTER_NAME
Delete a printer queue
Warning: this removes the printer queue.
sudo lpadmin -x PRINTER_NAME
Verify it is gone:
lpstat -p
lpstat -t
Rename a printer queue
CUPS does not really βrenameβ a printer queue directly.
Safe method:
1. Create a new printer queue with the new name.
2. Test the new queue.
3. Remove the old queue.
Example:
sudo lpadmin -p NEW_PRINTER_NAME -E -v ipp://PRINTER_HOSTNAME/ipp/print -m everywhere
lpstat -t
echo "test" | lp -d NEW_PRINTER_NAME
sudo lpadmin -x OLD_PRINTER_NAME
Modify printer device URI
Change the printer connection/URI:
sudo lpadmin -p PRINTER_NAME -v NEW_DEVICE_URI
Example:
sudo lpadmin -p office_printer -v ipp://printer01.example.com/ipp/print
Verify:
lpstat -v PRINTER_NAME
Change printer driver/model
Using driverless IPP Everywhere:
sudo lpadmin -p PRINTER_NAME -m everywhere
Using a PPD:
sudo lpadmin -p PRINTER_NAME -P /path/to/file.ppd
Restart CUPS if needed:
sudo systemctl restart cups
Verify:
lpstat -t
lpoptions -p PRINTERNAME
Printer Settings Management
Check Available Settings
To list all available settings (e.g., trays, page sizes) for a printer:
lpoptions -p PRINTER_NAME -l
This will show all configurable options, such as:
- InputSlot/Media Source (trays)
- PageSize/Media Size (paper sizes)
- Duplex (double-sided printing)
- Resolution (print quality)
Check Current Settings
To view the current settings for a printer:
lpoptions -p PRINTER_NAME
Change Default Tray (InputSlot)
1. List Available Trays
lpoptions -p PRINTER_NAME -l | grep "InputSlot"
Example Output:
InputSlot/Media Source: Default Tray1 *Tray2 Tray3 Tray4 Manual Envelope
- The
*indicates the currently selected default tray.
2. Set a Default Tray
Use the lpadmin command to set the default tray:
sudo lpadmin -p PRINTER_NAME -o InputSlot=<tray_name>
Example:
sudo lpadmin -p PRINTER_NAME -o InputSlot=Tray1
3. Verify the Change
lpoptions -p PRINTER_NAME | grep InputSlot
Change Default Paper Size (PageSize)
1. List Available Paper Sizes
lpoptions -p PRINTER_NAME -l | grep "PageSize"
Example Output:
PageSize/Media Size: Letter Legal Executive Tabloid A3 *A4 A5 B5 EnvISOB5 Env10 EnvC5 EnvDL EnvMonarch
- The
*indicates the currently selected default paper size.
2. Set a Default Paper Size
sudo lpadmin -p PRINTER_NAME -o PageSize=<paper_size>
Example:
sudo lpadmin -p PRINTER_NAME -o PageSize=A4
3. Verify the Change
lpoptions -p PRINTER_NAME | grep PageSize
Change Other Printer Settings
You can change other settings (e.g., Duplex, Resolution) in the same way:
1. List Available Options
lpoptions -p PRINTER_NAME -l | grep "<option_name>"
Example for Duplex:
lpoptions -p PRINTER_NAME -l | grep "Duplex"
2. Set the Option
sudo lpadmin -p PRINTER_NAME -o <option_name>=<value>
Example for Duplex:
sudo lpadmin -p PRINTER_NAME -o Duplex=DuplexNoTumble
3. Verify the Change
lpoptions -p PRINTER_NAME | grep <option_name>
Set Settings for a Single Print Job
To use specific settings for a single print job (without changing the default), use the lp command:
lp -d PRINTER_NAME -o <option_name>=<value> <file>
Examples:
lp -d PRINTER_NAME -o InputSlot=Tray3 document.pdf
lp -d PRINTER_NAME -o PageSize=A4 document.pdf
lp -d PRINTER_NAME -o Duplex=DuplexNoTumble document.pdf
Restart CUPS After Changes
If changes do not take effect immediately, restart the CUPS service:
sudo systemctl restart cups
Print queue checks
Show print jobs
lpq
For a specific printer:
lpq -P PRINTER_NAME
Show jobs with lpstat
lpstat -o
For a specific printer:
lpstat -o PRINTER_NAME
Cancel one print job
cancel JOB_ID
Example:
cancel printer-123
Cancel all jobs for one printer
cancel -a PRINTER_NAME
Be careful. This removes queued jobs.
Test printing
Simple test print
echo "CUPS test print" | lp -d PRINTER_NAME
Print a file
lp -d PRINTER_NAME /path/to/file
Print using lpr
lpr -P PRINTER_NAME /path/to/file
Network printer checks
If the printer is network-based, check connectivity.
Ping printer
ping -c 4 PRINTER_IP_OR_HOSTNAME
Test DNS
dig PRINTER_HOSTNAME
or:
nslookup PRINTER_HOSTNAME
Common printer ports
631 = IPP / CUPS
9100 = AppSocket / JetDirect / raw printing
515 = LPD/LPR
Check printer port
Using nc:
nc -vz PRINTER_IP 631
nc -vz PRINTER_IP 9100
If nc is not available:
curl -v telnet://PRINTER_IP:631
curl -v telnet://PRINTER_IP:9100
Firewall checks
If the CUPS server is used by other systems, check firewall.
Check firewalld state
sudo firewall-cmd --state
List firewall rules
sudo firewall-cmd --list-all
CUPS/IPP port
IPP usually uses:
631/tcp
Check listening ports:
ss -tulpn | grep :631
Configuration files
Common CUPS configuration files:
/etc/cups/cupsd.conf
/etc/cups/printers.conf
/etc/cups/ppd/
Check files:
ls -lah /etc/cups/
ls -lah /etc/cups/ppd/
Do not edit these blindly on production systems.
Restart after config changes
If configuration was changed:
sudo systemctl restart cups
Then verify:
systemctl status cups
lpstat -t
journalctl -u cups -n 100
Common issues
CUPS service is stopped
Check:
systemctl status cups
Fix:
sudo systemctl start cups
Verify:
systemctl status cups
lpstat -t
Printer queue is disabled
Check:
lpstat -t
Fix:
sudo cupsenable PRINTER_NAME
sudo cupsaccept PRINTER_NAME
Verify:
lpstat -t
Jobs are stuck
Check:
lpstat -o
lpq -P PRINTER_NAME
Cancel specific job:
cancel JOB_ID
Cancel all jobs for one printer:
cancel -a PRINTER_NAME
Verify:
lpstat -o
Printer is unreachable
Check:
ping -c 4 PRINTER_IP_OR_HOSTNAME
ip r
dig PRINTER_HOSTNAME
Check ports:
nc -vz PRINTER_IP 631
nc -vz PRINTER_IP 9100
Safe workflow for creating a printer
1. Confirm printer IP or hostname.
2. Check whether the printer supports IPP Everywhere.
3. Test network connectivity.
4. Check printer port.
5. Create queue.
6. Enable queue.
7. Accept jobs.
8. Send test print.
9. Verify with lpstat.
Commands:
ping -c 4 PRINTER_IP_OR_HOSTNAME
nc -vz PRINTER_IP 631
nc -vz PRINTER_IP 9100
sudo lpadmin -p PRINTER_NAME -E -v ipp://PRINTER_HOSTNAME/ipp/print -m everywhere
sudo cupsenable PRINTER_NAME
sudo cupsaccept PRINTER_NAME
echo "CUPS test print" | lp -d PRINTER_NAME
lpstat -t
Safe workflow for deleting a printer
1. Confirm the exact printer queue name.
2. Check if jobs are waiting.
3. Confirm nobody still needs the queue.
4. Delete the queue.
5. Verify it is removed.
Commands:
lpstat -p
lpstat -o PRINTER_NAME
sudo lpadmin -x PRINTER_NAME
lpstat -p
First command set
When I do not know what is wrong yet:
hostnamectl
systemctl status cups
lpstat -t
lpstat -p
lpstat -o
lpstat -v
ss -tulpn | grep :631
journalctl -u cups -n 100
sudo tail -n 100 /var/log/cups/error_log
Dangerous actions
Be careful with:
sudo lpadmin -x PRINTER_NAME
cancel -a PRINTER_NAME
sudo cupsdisable PRINTER_NAME
sudo cupsreject PRINTER_NAME
sudo systemctl restart cups
editing /etc/cups/printers.conf
editing /etc/cups/cupsd.conf
removing printer queues
changing default printer settings
These can affect active users and print jobs.
Personal notes
Add sanitized notes here.
Examples:
- Printer queue was disabled.
- Jobs were stuck and needed cancel.
- CUPS service was stopped.
- Printer was unreachable on network.
- Firewall blocked port 631.
- Printer needed IPP driverless setup.
- Printer required AppSocket and PPD.
- Printer settings (tray, page size) were incorrect.