All Exams Test series for 1 year @ ₹349 only
Question

In Linux operating system environment ________ command is used to print a file.

The correct answer is

lpr

Understanding File Printing in Linux Environments

In the Linux operating system, managing files and interacting with system peripherals like printers is typically done through command-line interface tools. The question asks about the specific command used for sending a file to a printer.

Let's examine the provided options in the context of Linux commands:

  • print: This is not a standard Linux command for printing files directly from the command line. While printing involves this concept, the command name isn't simply 'print'.
  • lpr: This command is part of the CUPS (Common Unix Printing System) package, which is widely used in modern Linux distributions for managing printing. The lpr command sends files to the print spooler, which then handles directing the job to the appropriate printer.
  • ptr: This is not a recognized standard Linux command for printing.
  • pr: This command is used for formatting or paginating files for printing, not for sending the file to the printer itself. It prepares the file output with headers, footers, and multiple columns, which can then be piped to a printing command like lpr.

Based on the standard utilities available in most Linux environments for sending files to a printer, the correct command is lpr.

The lpr command typically works by adding files to the print queue. For example, to print a file named document.txt, you would use the command:

lpr document.txt

You can often specify the printer using the -P option:

lpr -P printer_name document.txt

Therefore, the command specifically designed for printing a file by sending it to the print spooler in Linux is lpr.

Revision Table: Linux Printing Commands

Command Primary Function Relevance to Printing
lpr Sends files to the print spooler/queue. Directly used for printing files.
pr Formats/paginates files for printing. Used to prepare files before sending them to a printer (often with lpr).
lpq Checks the status of the print queue. Related command for managing print jobs.
lprm Removes jobs from the print queue. Related command for managing print jobs.

Additional Information: The CUPS Printing System

Modern Linux distributions widely use the Common Unix Printing System (CUPS). CUPS is modular and relies on a set of commands and configuration files to manage printing services. The lpr command is one of the primary user-facing commands provided by CUPS for initiating print jobs. Other commands like lpq (list print queue), lprm (remove print jobs), and lpstat (print status information) are also part of the CUPS suite, offering comprehensive control over the printing process from the command line.

Understanding these commands is essential for effective command-line management of printing in a Linux environment.

Was this answer helpful?

Important Questions from File System

  1. A mechanism for arranging controlled access to a shared resource, like a file, is called:

  2. Which UNIX/Linux command is used to make all files and sub-directories in the directory “progs” executable by all users?

  3. Consider the following statements :

    (a) UNIX provides three types of permissions

    Read

    Write

    Execute

    (b) UNIX provides three sets of permissions

    permission for owner

    permission for group

    permission for others

    Which of the above statement/s is/are true ?

  4. Match the following WINDOWS system calls and UNIX system calls with reference to process control and File manipulation.

    Windows

    UNIX

    A. Create-process( )

    I. Open( )

    B. WaitForSingleObject( )

    II. Close( )

    C. CreateFile( )

    III. Fork( )

    D. CloseHandle( )

    IV. Wait( )

  5. File manipulation operations in an operating system include:

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App