nerdexam
Linux_Foundation

LFCS · Question #453

What command should be entered to print and then delete the file, foobar.txt?

The correct answer is C. lpr -r foobar.txt. To print a file and then automatically delete it after it has been spooled, the lpr command with the -r option is used.

Submitted by alyssa_d· Apr 18, 2026Essential Commands

Question

What command should be entered to print and then delete the file, foobar.txt?

Options

  • Alpr -0 delete foobar.txt
  • Blpr -d foobar.txt
  • Clpr -r foobar.txt
  • Dlpr -0 remove foobar.txt

How the community answered

(38 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    89% (34)
  • D
    5% (2)

Why each option

To print a file and then automatically delete it after it has been spooled, the `lpr` command with the `-r` option is used.

Alpr -0 delete foobar.txt

`-0 delete` is not a valid or standard option for the `lpr` command to remove a file after printing.

Blpr -d foobar.txt

The `-d` option in `lpr` is typically used to specify a destination printer, not to delete the file.

Clpr -r foobar.txtCorrect

The `lpr -r` command prints the specified file and then automatically removes (deletes) it from the file system after the print job has been successfully spooled. This is useful for temporary files or sensitive documents that shouldn't persist on the disk after printing.

Dlpr -0 remove foobar.txt

`-0 remove` is not a valid or standard option for the `lpr` command to remove a file after printing.

Concept tested: `lpr` command options for file handling

Source: https://www.cups.org/doc/man-lpr.html

Topics

#lpr command#printing#file removal#command-line utilities

Community Discussion

No community discussion yet for this question.

Full LFCS Practice