Job 37 is in queue office.
Cancel only job 37 and keep other jobs.
Which command is appropriate?
lprm with a job ID cancels that job; a standalone dash requests all jobs.
Detailed explanation
lprm -P office -Incorrect. A standalone dash cancels every job in the queue.
Incorrect. A standalone dash cancels every job in the queue.
lpq -P office 37Incorrect. lpq displays the queue.
Incorrect. lpq displays the queue.
lprm -P office 37Correct. lprm -P office 37 cancels job 37.
Correct. lprm -P office 37 cancels job 37.
lpr -P office 37Incorrect. lpr would submit 37 as a file.
Incorrect. lpr would submit 37 as a file.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'destination=office job-id=37 action=cancel'Expected result
destination=office job-id=37 action=cancelKey points
- lprm cancels
- Limit by job ID
- Dash means all
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.