Printers and printing
Printing with CUPS: the path a job takes from a command to a printer, the commands for queues and jobs, and the two command families that do the same things under different names.
Lesson 4 of 4 in objective 108. Essential system services, part of LPIC-1 Exam 102-500.
CUPS, and what happens to a job
CUPS is the printing system on essentially every Linux machine. A job submitted with lp or lpr is spooled under /var/spool/cups, filtered into a format the printer understands, and sent to the device by a backend. Printers and classes are defined in /etc/cups/printers.conf and the server itself in /etc/cups/cupsd.conf, though both are normally managed through the web interface on port 631 rather than edited.
CUPS splits its files by purpose in the ordinary way, and a backup question is really a question about that split: CONFIGURATION under /etc/cups, spooled jobs under /var/spool/cups, logs under /var/log/cups. So /etc/cups holds cupsd.conf, printers.conf and a ppd/ directory of the PostScript Printer Description files — one per queue, describing what that model can do — alongside classes.conf, client.conf and cups-files.conf. What is NOT there is error_log, which is a log, or any spool directory. Editing printers.conf by hand is discouraged because the running scheduler rewrites it; lpadmin and a reload are the supported route.
A printer has both a queue and an enabled/disabled state, and they are separate: a queue can accept jobs while the printer is stopped, so work piles up safely, and that separation is exactly what an exam question about "jobs accepted but nothing printing" is testing.
Two vocabularies for the same operations
The System V family is lp to print, lpstat to see status, and cancel to remove a job. The BSD family is lpr, lpq and lprm. CUPS implements both, so either set is a correct answer unless the question names one. lpadmin is the administrative command that adds, modifies and removes printers.
Jobs already queued belong to a destination, and moving them to another one is a scheduler operation rather than a resubmission: lpmove laser laser2 hands everything waiting on laser to laser2, and lpmove takes a single job id in place of the first queue name when only one job is meant. It needs administrative rights when the jobs belong to other users. The pairing to remember is that lpmove rescues what is already there while cupsreject or cupsdisable stops anything new arriving, so a dead printer wants both.
The two switches have two commands each, and CUPS ships both spellings of both. Whether a queue TAKES new jobs is accept and reject, which CUPS also installs as cupsaccept and cupsreject — the same programs under the names that do not collide with anything else on the system. Whether a queue SENDS what it has is cupsenable and cupsdisable. So taking a printer out of service for maintenance and having users told immediately is cupsreject laserjet: the queue refuses submissions at the door, rather than accepting work that will sit there. cupsdisable laserjet is the other choice and does the opposite — it keeps accepting and stops printing, which is what you want when the printer is coming back in an hour.
lpstat -p laserjetprinter laserjet is idle. enabled since Mon 03 Aug 18:40:02cupsreject laserjetlpr -P laserjet report.pdflpr: Destination "laserjet" is not accepting jobs.told at submission, rather than piling upcupsaccept laserjet
Worth carrying in
- lp / lpr
- Submit a job. System V and BSD spellings.
- lpstat -t / lpq
- Everything about the queues; the BSD equivalent.
- cancel / lprm
- Remove a job from the queue.
- lpadmin
- Add, modify or delete a printer.
- lpmove laser laser2
- Move queued jobs to another destination without asking users to resubmit.
- /etc/cups/ppd/
- One printer description per queue. Jobs live under
/var/spool/cups, logs under/var/log/cups. - cupsreject / cupsaccept
- Whether the queue takes new jobs. Spelled
rejectandaccepttoo. - cupsenable / cupsdisable
- Whether the queue sends the jobs it has to the printer.
- /etc/cups/cupsd.conf
- CUPS server configuration; the web interface is at
http://localhost:631/.
What the exam does with this
- Accepting jobs and printing them are two independent switches.
cupsrejectrefuses submissions;cupsdisableaccepts them and stops sending. A stopped printer with an accepting queue is a designed state. - Recognise both command families: lp/lpstat/cancel and lpr/lpq/lprm.
- CUPS listens on port 631.
- Objective
- 108. Essential system services
- Share of the exam
- 18.33% (the whole objective)
- Questions in this lesson
- 10
- Signed for by a person
- 0
Partly checked. None of the 10 questions here has been read against the cited source by a person. 10 questions have been checked against their cited clause by an automated pass — which is not the same thing, and is not a signature.
Only questions a person has signed for are used in mock exams here. That is the whole difference between the two kinds of checking above.
How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.
Drill this lesson
A lesson is one sitting: the trainer draws a short run from these questions alone and spaces the ones you get wrong.
Practise Printers and printing
Questions in this lesson
- A print job you submitted is stuck and you want to remove it from the CUPS queue. Which pair of commands finds the job id and then deletes that job? machine-checked
- A printer must be taken out of service for maintenance. You want the queue to refuse any new submissions, so users are told immediately rather than having work pile up. Which command does that? machine-checked
- Which URL reaches the CUPS administration web interface on the local machine, and which directory holds the CUPS configuration files? machine-checked
- A network printer reachable at ipp://printer.example.com/ipp/print must be added to CUPS as a queue named laser, ready to accept and print jobs at once. Which command creates it? machine-checked
- A user wants to stop the job that is currently printing on their default destination, without first looking up its job id. Type the System V style CUPS command, with no options or arguments, that does this. machine-checked
- CUPS implements both the BSD and the System V printing command sets. Type the System V command, with no options, that reports printer and job status: the counterpart of the BSD command lpq. machine-checked
- Jobs submitted with no destination named are coming out on the wrong printer. Which command reports which destination CUPS currently treats as the default? machine-checked
- The printer behind the queue laser has failed and will be off for days. Several jobs are already queued on it and must be printed today on the identical device behind the queue laser2, without asking the users to submit them again. Which command does that? machine-checked
- An old script prints with `lpr -P accounts report.ps`. You are rewriting it to use the System V command lp instead. Which option of lp names the destination? machine-checked
- You are taking a backup of a print server's CUPS configuration before an upgrade. Which THREE of the following are found under /etc/cups on a standard installation? machine-checked
Practise Printers and printing
The rest of objective 108
- Keeping system time correct
- System logging
- Mail transfer agent basics
- Printers and printing — you are here