One of the most unpleasant topics in LPIC-1 (LPI 102) is the one about printing. That's why I have prepared the following must-know cheatsheet about the exam.
/etc/printcap - the file which describes the available printers and their options. Used by the main spooling daemon. Important options:
if=input_filter
lp=printer_device
lf=log_file
mx=max_size
sd=spool_directory
/var/spool/lpd/lpi - the spooling directory for a sample printer called 'lpi'. It contains all the queued print jobs and control files for the lpi printer.
lpq [Options] [Users] [job id]
# lpq -Plpi - show the queued jobs for the lpi printer
lprm [-Pprinter name] [users] [job id] - remove printer jobs
lpc [command] [printer name] [job id] - printing control
# lpc help
Commands may be abbreviated. Commands are:
abort enable disable help restart status topq ?
clean exit down quit start stop up
# lpc topq lpi 102 - move print job 102 to the top of the queue for the lpi printer
# lpc disable lpi - disallow new jobs to be queued for the lpi printer. Allow the ones already queued to be completed.
Here is the ultimate printing command 'lpr -Plpi -J "LPI test print" -#2 -m -p -q -r lpi.txt' - this means to use the printer lpi, to name the job "LPI test print", to make 2 copies of it, send mail upon completion, to make it in Pretty format, to queue it for later and finali to remove the file when done.
lpstat -s = lpstat -d -c -v - Display default printer, all available printers and classes
lpstat -p = lpc status - check printers' statuses
Use cupsenable and cupsdisable to enable and disable a printer.
# lp -i 16 -n 5 - change the number of copies to 5 for job id 16
Filters are used to convert generic data to printable data:
Raw data -> Post Script (PDL format) -> Ghost Script (Printer specific data) -> Printer
To use a Samba printer you need to:
1. use smbprint input filter
2. Have a .config file with in the spool directory defining server, service and password.
CUPS uses MIME types to determine the correct filter for a file.
lpadmin -x [printer name / printer class] - deletes a printer / class.
A printer class is responsible for properly distributing the jobs to a group of printers.


