Konfiguracja
Dodawanie i usuwanie
Zobacz dostępne urządzenia (lokalne i w sieci):
lpinfo -v
Przykład użycia:
$ sudo lpinfo -v
Password:
file cups-pdf:/
network beh
direct hp
network ipps
network https
network socket
network http
network ipp
network lpd
direct hpfax
network socket://192.168.0.100
Pokaż wszystkie dostępne sterowniki:
lpinfo -m
Wyszukaj dla konkretnego modelu:
$ lpinfo --make-and-model "Samsung SCX-3200" -m
drv:///splix-samsung.drv/scx3200.ppd Samsung SCX-3200, 2.0.0
Drukarki
Dodaj drukarkę:
lpadmin -p pdf1 -E -v 'cups-pdf:/' \
-i /usr/share/ppd/cupsfilters/Generic-PDF_Printer-PDF.ppd -o PageSize=a4
Pokaż aktualnie domyślną:
$ lpstat -d
system default destination: pdf1
Pokaż pełny status:
$ lpstat -t
scheduler is running
no system default destination
members of class work-hp1:
HP_LaserJet_Pro_MFP_M125nw
device for HP_LaserJet_Pro_MFP_M125nw: socket://192.168.0.100
device for work-hp1: ///dev/null
HP_LaserJet_Pro_MFP_M125nw accepting requests since Wed 04 May 2019 10:31:03 CEST
work-hp1 accepting requests since Wed 04 May 2019 10:34:48 CEST
printer HP_LaserJet_Pro_MFP_M125nw is idle. enabled since Wed 04 May 2019 10:31:03 CEST
printer work-hp1 is idle. enabled since Wed 04 May 2022 00:34:48 CEST
Pokaż status przetwarzania wszystkich destynacji1:
$ lpstat -p
printer HP_LaserJet_Pro_MFP_M125nw is idle. enabled since Wed 04 May 2019 10:31:03 CEST
printer work-hp1 is idle. enabled since Wed 04 May 2019 10:34:48 CEST
Pokaż urządzenia dla każdej destynacji:
$ lpstat -v
device for HP_LaserJet_Pro_MFP_M125nw: socket://192.168.0.100
device for work-hp1: ///dev/null
Szukaj tylko konkretnych
lpinfo --include-schemes dnssd -v
lpinfo --include-schemes ipp -v
Pokaż podsumowanie stanu:
$ lpstat -s
no system default destination
members of class work-hp1:
HP_LaserJet_Pro_MFP_M125nw
device for HP_LaserJet_Pro_MFP_M125nw: socket://192.168.0.100
device for work-hp1: ///dev/null
Administracja
Włącz udostępnianie drukarek i dodaj drukarkę:
cupsctl --share-printers
lpadmin -p foo -o printer-is-shared=true
Wyłącz udostępnianie drukarek:
cupsctl --no-share-printers
Dodaj użytkownika do lpadmin
usermod -aG lpadmin <username>
Obsługa
Ustaw jako domyślną:
lpoptions -d <printer-name>
lpoptions -p lp1/double -o media=a4 -o number-up=2
To ustawienie zostanie zapisane ~/.cups/lpoptions.
Możesz też ustawić zmienne środowiskowe LPDEST lub PRINTER.
W Bashu - ~/.bashrc:
export PRINTER=<printer-name>
W csh/tcsh - ~/.cshrc albo ~/.tcshrc:
setenv PRINTER <printer-name>
Opcje
Pokaż wszystkie dostępne opcje dla drukarki:
lpoptions -l
lpoptions -d <printer> -l
Status
lpstat -p
printer q1 disabled since Fri 14 Oct 2019 07:36:09 AM CEST -
Paused
Enable
cupsenable q1
albo
lpadmin -p q1 -E
lpstat -p
printer q1 now printing q1-174. enabled since Fri 14 Oct 2019 07:37:52 AM CEST
Processing page 1...
lpc status
q1:
printer is on device 'usb' speed -1
queuing is enabled
printing is enabled
1 entries
daemon present
Drukowanie
Wysłanie do druku tylko konkretnych stron:
lp -o page-ranges=1,3-4,7 <filename>
lp -P 1,3-4,7 <filename>
Kilka kopii
lp -n num-copies filename
lpr -#num-copies filename
lp -o landscape -o fit-to-page -o media=A4 filename.jpg
Włącz opcję collate, żeby kopie wyszły posortowane
lp -n num-copies -o collate=true filename
lpr -#num-copies -o collate=true filename
Drukowanie dwustronne
lp -o number-up=2 -o page-set=even -o outputorder=reverse doc.pdf
# przełóż wydrukowane do podajnika
lp -o number-up=2 -o page-set=odd doc.pdf
Drukowanie man
man -t ls > ls.ps && ps2pdf ls.ps && rm ls.ps
Dokumenty odt
libreoffice -p filename.odt
libreoffice --pt [cupsname] filename.odt
Kolejka
Wysłanie zatrzymanego wydruku:
lpq
lp -i <job-id> -H resume
Usunięcie wszystkich zadań wydruku
cancel -a
Skrypt:
##!/bin/sh
##
## script to resume the top job on the default printer queue
j=`lpstat | head -1 | cut -d' ' -f1`
if [ "$j" = "" ]; then
echo 1>&2 "No jobs in queue."
exit 1
fi
echo "releasing \"$j\"..."
lp -i "$j" -H resume
lpstat -l
More information
| Package name | Drivers for printers |
|---|---|
| cups | Zebra, Dymo |
| c2esp | Kodak |
| foomatic | Brother, Canon, Epson, Gestetner, HP, Infotec, Kyocera, Lanier, Lexmark, NRG, Ricoh, Samsung, Savin, Sharp, Toshiba, Xerox, and others |
| gutenprint-cups | Brother, Canon, Epson, Fujitsu, HP, Infotec, Kyocera, Lanier, NRG, Oki, Minolta, Ricoh, Samsung, Savin, Xerox, and others |
| hplip | HP |
| pnm2ppa | HP |
| splix | Samsung, Xerox, and others |
$ man -T ascii -O width=68,indent=1 lpadmin | col -b | grep -A4 "^ -E"
-E When specified before the -d, -p, or -x options, forces the
use of TLS encryption on the connection to the scheduler.
Otherwise, enables the destination and accepts jobs; this is
the same as running the cupsaccept(8) and cupsenable(8)
programs on the destination.
Destynacja nie musi być fizycznym urządzeniem. ↩︎