{{indexmenu>:computing:department:unix}}
====== Printing from Unix ======
The command to print from a Unix system to any of our network printers is:
lpr -P//queuename// //filename//
...where //queuename// is the name of the print queue (usually the room number). The queues accept many file types directly, such as image files and PDF as well as text or Postscript. Additional print options can be specified to select features such as duplex or portrait/landscape orientation.
===== Controlling printer features =====
We use CUPS (common unix printing system) for both Tru64 and Linux systems.
For complete information on printing options, please refer to the CUPS User Manual at [[http://www.cups.org/]].
For quick reference, 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
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
===== 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
You can also use lpoptions to set other preferences such as duplexing, etc.
===== 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 [[http://lpr.spa.umn.edu:631/jobs|jobs listing]] (this link will only work within Tate Lab).
===== Printing to Toshiba copiers =====
To print to the Tosiba copiers (358c and 431c), 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 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:
lpoptions -o DCDigit1=1 -o DCDigit2=0 -o DCDigit3=2 -o DCDigit4=0 -o DCDigit5=3 -p 358c
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).
===== 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 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 physics.umn.edu "cat - |lpr -P342"'
tcsh> lp342 myfile.ps