Skip to content

Printers

Before Configuring the Default Printer in Linux check with lpstat command

lpstat -t

Set Default Printer Linux Terminal

lpoptions -d <Printer Name>

We can also setup an default printer using simple environment variable adding into user profile file called ~/.bashrc

export PRINTER=printer-name

Displaying printer settings

lpoptions | tr " " '\n'

With the -v option, the lpinfo command will list drivers and related information.

lpinfo -v

The lpoptions command will show the settings of the default printer. Use the -p option to specify one of a number of available printers.

lpoptions -p <Printer Name>

Useful commands

  1. To print a document on the default printer, just use the lp command followed by the name of the file you want to print.

    lp fileName.pdf
    

  2. The lpq command displays the print queue.

  3. With the -n option, the lp command allows to specify the number of copies of a printout we  want. lp -n 11 fileName
  4. To cancel a print job, we can use the cancel or lprm command.
  5. To print in two-sided mode, use
    lp -o sides=two-sided-long-edge fileName.pdf
    
  6. If we want all of our documents to print in two-side mode, we can change our lp settings by using the lpoptions command to change the setting for sides.
    lpoptions -o sides=two-sided-short-edge