96 lines
1.6 KiB
Markdown
96 lines
1.6 KiB
Markdown
---
|
|
publish: true
|
|
permalink: /os/printing
|
|
title: Printing
|
|
created: 2026-02-05T08:52:25.911-07:00
|
|
modified: 2026-02-05T12:18:10.587-07:00
|
|
tags:
|
|
- printing
|
|
- cups
|
|
cssclasses: ""
|
|
---
|
|
|
|
CUPS printing setup for Arch Linux.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
sudo pacman -S cups cups-pdf
|
|
```
|
|
|
|
## Enable Services
|
|
|
|
```bash
|
|
sudo systemctl enable --now cups
|
|
sudo systemctl enable --now avahi-daemon
|
|
```
|
|
|
|
Avahi enables automatic network printer discovery.
|
|
|
|
## Configuration
|
|
|
|
### Web interface
|
|
|
|
Access CUPS admin at: http://localhost:631
|
|
|
|
### Add printer via CLI
|
|
|
|
```bash
|
|
# List available printers
|
|
lpinfo -v
|
|
|
|
# Add a printer
|
|
lpadmin -p PrinterName -E -v "uri" -m "driver.ppd"
|
|
|
|
# Set default printer
|
|
lpoptions -d PrinterName
|
|
```
|
|
|
|
### Network printers (auto-discovery)
|
|
|
|
With Avahi running, network printers should appear automatically. If not:
|
|
|
|
```bash
|
|
# Install nss-mdns for .local hostname resolution
|
|
sudo pacman -S nss-mdns
|
|
|
|
# Edit /etc/nsswitch.conf, add mdns_minimal before resolve:
|
|
hosts: mymachines mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns
|
|
```
|
|
|
|
## Print to PDF
|
|
|
|
The `cups-pdf` package creates a virtual PDF printer:
|
|
|
|
```bash
|
|
# Print to PDF (outputs to ~/PDF/)
|
|
lp -d cups-pdf document.txt
|
|
```
|
|
|
|
## Useful Commands
|
|
|
|
```bash
|
|
lpstat -p # List printers
|
|
lpstat -t # Full status
|
|
lp -d PrinterName file # Print file
|
|
cancel <job-id> # Cancel print job
|
|
lprm <job-id> # Remove print job
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
```bash
|
|
# Check CUPS status
|
|
systemctl status cups
|
|
|
|
# View logs
|
|
journalctl -u cups -f
|
|
|
|
# Restart CUPS
|
|
sudo systemctl restart cups
|
|
```
|
|
|
|
## Resources
|
|
|
|
- Arch Wiki: https://wiki.archlinux.org/title/CUPS
|