See UNIX commands for further reference and additional commands.

How to Print from the Command Line in Linux

To print a file from a computer at the CIMS lab, simply type the following line:

lpr -Pprinter_name file_name

where printer name is the name of the printer you wish to print to( i.e. nhp36 ), all the printers have labels with their designation. To get a listing of all jobs that are currently in the queue for a particular printer, enter the following command:

lpq -Pprinter_name

To remove your particular job from the queue, you can type:

lprm -Pprinter_name job_id

Printing Options

Simplex/Duplex Printing

All the public printers are set to print duplex (i.e. on both sides of the paper) by default. If you need to print simplex, there are a couple of alternatives. While we discourage people from turning off the duplex option on the control panel, it may have been changed to simplex. To ensure that you receive the desired printout, refer to the following examples for simplex/duplex printing.

Use lp instead of lpr. Printer specific options can be passed to the printer via lp, but not via lpr.

Simplex Printing:

The general command to print a file in simplex mode is

lp -d printer_name -o simplex file_name

For example, the command

lp -d nhp15 -o simplex foo.txt

will print the file foo.txt to the printer named nhp15 in simplex mode

Duplex Printing:

The general command to print a file in duplex mode is

lp -d printer_name -o duplex file_name

The command

lp -d nhp15 -o duplex foo.txt

will print the file foo.txt to the printer named nhp15 in duplex mode

Transparency Printing

When printing a transparency, use the following command:

lp -d printer_name -o mtypeTransparency

Page Banners

To enable page banners:

lp -d printer_name -o banner

To disable page banners:

lp -d printer_name -o nobanner

File Types

All of our printers are postscript printers. Do not send binary files directly to the printer. You must instead use an application capable of converting it to Postscript when it sends the job to the printer.
Some examples ...

  • pdf: to print a pdf document, use acroread.
  • jpg: use xv. Do not try lpr -Pnhp35 foo.jpg.
  • dvi: use dvips.
    note: To print a dvi file in simplex mode you can do the following ...
    dvips -f file.dvi | lp -dnhp15 -osimplex