108.4. Manage printers and printing
Weight: 2
Description: Candidates should be able to manage print queues and user print jobs using CUPS and the LPD compatibility interface.
Key Knowledge Areas:
Basic CUPS configuration (for local and remote printers)
Manage user print queues
Troubleshoot general printing problems
Add and remove jobs from configured printer queues
Terms and Utilities:
CUPS configuration files, tools and utilities
/etc/cups/
lpd legacy interface (lpr, lprm, lpq)
Although much of our communication today is electronic and paperless, we still have considerable need to print material from our computers.
cups
CUPS is the standards-based, open source printing system developed by Apple Inc. for macOS® and other UNIX®-like operating systems.It stands for Common UNIX Printing System. The CUPS system can act as a printer server for a local machine or a network of machines.
CUPS consists of:
Print spooler/scheduler: Lines up printing jobs to be sent to the printer.
Filter system: Converts data so that the attached printer can understand and format the data being printed.
Backend system: Transports data from filters to printer.
At the heart of the CUPS printing system is the
cupsd
print server which runs as a daemon process.
cups web interface
There are different interfaces for cups like gui , web interfaces and even traditional command line interfaces. Here we show the CUPS web administration tool (http://localhost:631 or http://127.0.0.1:631
) to search for or add printers.
If you are asked for a username and password when accessing the CUPS web interface (localhost:631), use your login name and password.
Obviously adding printer requires root access.(in ubuntu members of cups admin group are accepted too)
We need to know what driver to use for your printer. Not all printers are fully supported on Linux and some may not work at all, or only with limitations. Check the printer manufacturer’s website or take a look at OpenPrinting.org.
/etc/cups
The /etc/cups directory contains other configuration files related to CUPS (Fedora 30).
The CUPS configuration file is normally located in /etc/cups/cupsd.conf
note1:The default CUPS configuration limits administration to the local machine.
note2: Most of the settings are accessible from the web interface and it is not recommended to edit this file.
If any printer has been configured, the setting are stored in etc/cups/printers.conf
DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING!
lpd legacy interface
In UNIX and Linux systems, printing initially used the Berkeley Software Distribution (BSD) printing subsystem, consisting of a line printer daemon (lpd) running as a server, and client commands such as lpr to submit jobs for printing.
Nowadays many of these legacy tools still exist to keep backward compatibility.
command
usage
lpr
send file to printer
lpq
show print jobs
lprm
remove print jobs
lpc status
show printer status
lpq : q stands for queue and it is use full when we want to see printer jobs
-P
: show the jobs of specific printer-a
: show jobs of all printers.
There should be no space between -P and Printer's name!
-Pprintername
lpr : The simplest way to print any file is to use the lpr
command and provide the file name. Again use -P
to specify printer:
lprm : lprm removes job(s) from the printer's queue. We need to define Job ID for this command, if no Job ID is specified the older job is removed.
again -P can be used to specify the printer. Also we can use
lprm -Pprintername -
to remove all printer's jobs. Andlprm -
will remove all jobs from the default printer.Each user can remove his/her own jobs, but root can do any thing!
lpc : we can use lpc status command in order to check the printer health and troubleshoot (become root for better results!).
where
queuing is enabled: it means that printer will accept new jobs, if it was disabled it won't accept any new job even if the printer was ok.
printing is disabled: means that printer can not actually print on the paper. That happens if the printer is out of ink or paper or experiencing a paper jam.
In my case, my printer is out of paper. But there are some other cups command which might be helpful specially when a problem occurs:
command
describe
cupsaccept
tells the printer queue to accept new jobs
cupsreject
tells the printer to reject any new job
cupsenable
enables the actual/physical printing of the jobs
cupsdisable
disables the physical printing of the jobs
with all commands we can specify printer's name without -P switch !
Adding some papers :
And if we want to disable a printer intentionally, we can mention the reason with -r switch:
that's all!
.
.
.
https://developer.ibm.com/tutorials/l-lpic1-108-4/
https://wiki.archlinux.org/index.php/CUPS
https://www.linux.com/tutorials/linux-101-printing/
https://jadi.gitbooks.io/lpic1/content/1084_manage_printers_and_printing.html
.
Last updated