Go to the U of M home page
School of Physics & Astronomy
School of Physics and Astronomy Wiki

User Tools


Printing from Unix

Printing on Linux is handled through CUPS utilizing the cups.cse.umn.edu print server

The command to print from a Unix system to any of our network printers is:

lpr -P printer filename

…where printer is the name of the print queue (usually the room number). The queues accept many (but not all!) file types directly, such as image files and PDF as well as text or Postscript. Application-specific files such as HTML web pages, Mathematica workbooks, etc, have to be printed from within the application.

You can use the lpstat(1) command to see a list of available printers:

lpstat -a

Changing printer settings in KDE

If you want to use the GUI printing configuration utility under Settings→Printers rather than lpoptions as described below, they will overwrite and lose any settings you have made manually. Please just use one of the two methods to change options.

Controlling printer features

Additional print options can be specified to select features such as duplex or portrait/landscape orientation. A huge number of options is available, and you should consult the CUPS manual for complete details, but some example options include:

  • Where multiple trays are available, you can select which tray to print from using the -o media switch. For example:
    lpr -o media=Upper filename
    lpr -o media=Lower filename
  • Most duplex-capable printers are set to print on both sides by default. You can control this behaviour using the -o sides switch.
    lpr -o sides=two-sided-long-edge filename
    lpr -o sides=two-sided-short-edge filename
    lpr -o sides=one-sided filename
  • You can control orientation using the -o landscape switch.
    lpr -o portrait filename
    lpr -o landscape filename

Finding other available options and setting defaults

Some of these options are quite wordy; however you can use the lpoptions command to set up default settings to suit your preference (see the CUPS user manual for details). To view the available options, and their current settings for a particular printer, use the lpoptions -l command - for example,

lpoptions -p 216 -l

The above “generic” options such as sides=two-sided-long-edge may not work for setting defaults. Instead, find the specific option for your printer from lpoptions -p printer -l, and use that. For example the option to set duplex printing on the 431 HP printer may be something like lpoptions -p 431 -o Duplex=DuplexNoTumble.

Setting a default printer

If you want to select a particular printer as default, use the lpoptions -d command. You can then use this printer without having to use the -P parameter. For example:

lpoptions -d 216

NOTE in the past, one would set the default printer by setting an environment variable PRINTER in your login script. You should remove any such setting in order to avoid unexpected interactions.

Viewing print jobs

You can check the contents and status of a print queue using the lpstat command. For example,

lpstat 216

You can check queue and job status online by checking the print server jobs listing (this link will only work within Tate Lab).

Printing to Toshiba copiers

To print to the Toshiba color copiers in PAN, MIFA and FTPI, you need to specify your Department printing code. This is tedious to specify on the CUPS command line, but it can be done using the DCDigit1… DCDigit5 options.

Say your Department Code is 10203. Your command to print would be:

lpr -P 358c -o DeptCode=True -o DCDigit1=1 -o DCDigit2=0 -o DCDigit3=2 -o DCDigit4=0 -o DCDigit1=5 filename

You can avoid having to specify the code every time, by storing it using lpoptions. For example, to first store your code and then print a file:

lpoptions -o DeptCode=True -o DCDigit1=1 -o DCDigit2=0 -o DCDigit3=2 -o DCDigit4=0 -o DCDigit5=3 -p toshiba-pan-311
lpr -P toshiba-pan-311 filename

Note there are several possible places for your output to be delivered; you can control this using the OutputTray option. The default is the Inner tray (beneath the control panel).

<note warning>

  1. The Toshiba driver for linux only supports 5-digit codes - if you have a longer code, your jobs will be held (you can release it from the embedded web page of the copier itself). Contact us if you would like your code changed to 5-digits.
  2. Adobe's acroread printing doesn't work correctly with DeptCodes. You either have to release the job from the copier web interface, or use an alternative PDF viewer (try evince or qpdfview). You can also send PDF files directly to a printer using lpr.


Hint: Remote Printing

You can print to our print queues from a remote unix system, by piping your file through the “ssh” command. For example:

bash> cat myfile.ps |ssh ssh.physics.umn.edu "cat - |lpr -P342"

If you often need to print from a remote site, it should be fairly simple to embed these commands into a convenient script or alias. For example, if you use tsch:

tcsh> alias lp342 'cat \!\!:1 | ssh ssh.physics.umn.edu "lpr -P342"'
tcsh> lp342 myfile.ps

Or bash:

$ lp342() { cat $1 |ssh ssh.physics.umn.edu "lpr -P342" }
$ lp342 myfile.ps
computing/department/unix/printing.txt · Last modified: 2021/05/04 16:44 by cse-sull0153