aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/linux/cups.md
blob: 75b436ee013500dcd9772cbc38d221b42101fcc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# cups(1)

## Discover
```sh
# List available printer driver.
lpinfo -m

# List available printer devices (connected + network).
lpinfo -v
```
## Install printer
```sh
# Add device with PRINTER name, practically all modern network printer use the
# everywhere driver.
lpadmin -p PRINTER -m everywhere -v DEVICE_URI

# Delete named printer.
lpadmin -x PRINTER
```

## Printer & Printing options
```sh
# List printer options.
# CHECK printer-make-and-model
lpoptions -p PRINTER
# List printing options.
lpoptions -p PRINTER -l
# Set an options, eg duplex mode.
lpoptions -p PRINTER -o 'Duplex=DuplexNoTumble

# Set the default printer (stored in ~/.cups/lpoptions).
lpoptions -d PRINTER
```

## Inspect installed printer.
```sh
# List default printer.
lpstat -d
# List installed printer (-l for longer output).
lpstat -p
# List printer accepting state.
lpstat -a
# List printer and the attached device (eg device uri).
lpstat -v

# List all states at once.
lpstat -t
```
## Print jobs
```sh
# Create print job.
lp -d PRINTER FILE
    -n NUM                           number of copies
    -P PAGE_LIST                     pages to print (eg 1,3-5,10)
    -o media=a4                      paper format
    -o number-up={2|4|6|9|16}        input pages per output page
    -o sides=one-sided               print front-page only
    -o sides=two-sided-long-edge     print duplex

# Remove pending print job.
lprm JOOBID
```

## Control printer
```sh
# Enable/disable printer.
cupsenable PRINTER
cupsdisable PRINTER

# Accept/rejects jobs for printer.
cupsaccept PRINTER
cupsreject PRINTER
```