Use the CUPS Berkeley-compatible interface to submit report.pdf to printer office once.
Which command is appropriate?
lpr submits a file to a print queue and -P selects the destination printer or class.
Detailed explanation
lpr -P office report.pdfCorrect. lpr -P office submits report.pdf to office.
Correct. lpr -P office submits report.pdf to office.
lpq -P office report.pdfIncorrect. lpq displays queue status.
Incorrect. lpq displays queue status.
lprm -P office report.pdfIncorrect. lprm cancels queued jobs.
Incorrect. lprm cancels queued jobs.
lpstat -P office report.pdfIncorrect. lpstat reports status rather than submitting a file.
Incorrect. lpstat reports status rather than submitting a file.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'command=lpr destination=office file=report.pdf'Expected result
command=lpr destination=office file=report.pdfKey points
- lpr submits job
- -P destination
- Different from lpq and lprm
Notes
- Environment: 構文要素の表示のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.