Printing files on Unix (System V/BSD style): Which command is commonly used to send a file to the system's print spooler for printing?

Difficulty: Easy

Correct Answer: lp

Explanation:


Introduction / Context:
Unix printing relies on a spooler that queues jobs. Users submit jobs via commands that differ slightly across Unix flavors. Recognizing the standard submission command helps in scripts and day-to-day operations.



Given Data / Assumptions:

  • System V-style printing uses the lp command; BSD uses lpr.
  • We are asked for a generic, widely used Unix command to print a file.
  • Other listed commands resemble DOS terminology or unrelated utilities.


Concept / Approach:

The lp command submits a print job to the line printer system (System V lineage). Typical usage is lp filename, with options to select destination printers and copies. On BSD-like systems, the counterpart is lpr, but lp remains a correct and common answer in many Unix distributions.



Step-by-Step Solution:

Assess each option for Unix printing semantics.Select 'lp' because it is the canonical System V print submission command.Confirm that 'print' and 'prn' are DOS-style and 'pg' is a pager.Therefore 'lp' is the suitable answer.


Verification / Alternative check:

Running lp /etc/hosts returns a job ID if the spooler is configured. The job can be monitored with lpstat. This validates that lp is used for printing.



Why Other Options Are Wrong:

  • print, prn: DOS commands/aliases; not standard Unix print submission.
  • pg: Pager for viewing text; not for printing.
  • None of the above: Incorrect because 'lp' is valid.


Common Pitfalls:

Confusing System V (lp) with BSD (lpr). On some systems, both commands exist and map to the same underlying CUPS interface; still, 'lp' is fully correct for Unix printing.



Final Answer:

lp

More Questions from Unix

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion