Administração de impressoras disponíveis para o servidor

Comandos para utilizar no CUPS (servidor de impressão)

IMPRES.FAQ-30250
Exemplos obtidos do site: https://wiki.archlinux.org/index.php/CUPS

CUPS can be fully controlled from command-line with nice tools, i.e. the lp* and the cups* command families.

On Arch Linux, most commands support auto-completion with common shells. Also note that command-line switches cannot be grouped.

List the devices

lpinfo -v

List the drivers

lpinfo -m

Add a new printer

lpadmin -p printer -E -v device -P ppd

The printer is up to you. The device can be retrieved from the 'lpinfo -v' command. Example:

lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH"  -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz

In the following, the printer references the name you have used here to set up the printer.

Set the default printer

lpoptions -d printer

Check the status

lpstat -s
lpstat -p printer

Deactivate a printer

cupsdisable printer

Activate a printer

cupsenable printer

Remove a printer

First set it to reject all incoming entries:

cupsreject printer

Then disable it.

cupsdisable printer

Finally remove it.

lpadmin -x printer

Print a file
lpr file
lpr -# 17 file              # print the file 17 times
echo "Hello, world!" | lpr -p # print the result of a command. The -p switch adds a header.

Check the printing queue

lpq
lpq -a # on all printers

Clear the printing queue

lprm   # remove last entry only
lprm - # remove all entries