UNIX Printing

J. Brandt Buckley updated June 17, 2009 at 5:37 AM

Questions Addressed

  • How do I print directly from UNIX? How do I print directly from UNIX?

How to print from Solaris 2 and HP-UX operating systems.

CONTENTS
A. INTRODUCTION
B. POSTSCRIPT ONLY PRINTERS
C. PRINTING FROM SUN SOLARIS 2
D. PRINTING FROM HP-UX
E. CHECKING THE STATUS OF A PRINT JOB
F. CANCELLING A PRINT JOB
G. BUGS AND UNRESOLVED HP PRINTING ISSUES
A. INTRODUCTION
===============
We had hoped that there would be one simple command to use when
printing to any of our printers from either Sun or HP UNIX platforms.
Unfortunately this is not easily realized, due in part to the variety
of printers we have (AppleTalk, IP, PostScript) and complexity of
printer options (duplex, transparency, 11X17). Furthermore, Sun and HP
implement their lp commands very differently – Sun's version can pass
options to networked printers, HP's version cannot. (HP has instead
created a separate product, JetAdmin, which uses the jetprint command
in place of lp, which it then calls.)

The commands and options listed below should also work within Netscape.

B. POSTSCRIPT ONLY PRINTERS
===========================
For the following printers, when printing plain text files which are
not PostScript, you must first convert the file to PostScript:
helter
hippo
jsp
ophelia

For sending plain text files to any of the above printers, instead of
using a command of the form:
Sun Solaris 2 syntax:
lp -d $PRINTERNAME $FILENAME
or
HP-UX syntax:
lp -d$PRINTERNAME $FILENAME

please use (for both Solaris 2 and HP):
nenscript -d $PRINTERNAME $FILENAME

C. PRINTING FROM SUN SOLARIS 2
==============================
NOTE: space is required between switches and arguments of the lp command

1. PAPER OUTPUT – 8.5" X 11"
lp -d $PRINTERNAME $FILENAME
e.g.
lp -d raphael myfile

2. TRANSPARENCIES (available printers: raphael, klee)
lp -d $PRINTERNAME -o tray2 $FILENAME

3. DUPLEX printing (available printers: raphael, klee, pokey, mumbo, adams)
lp -d $PRINTERNAME -o duplex $FILENAME

4. 11" X 17" (available printers: raphael, mumbo, adams and orozco)
SINGLE SIDED
lp -d $PRINTERNAME -o 11x17 $FILENAME

2 SIDED
lp -d $PRINTERNAME -o 11x17 -o duplex $FILENAME

For 2 pages of 8.5x11 on 11x17 paper, 2 sided:
lp -d $PRINTERNAME -o 11x17 -o tumble $FILENAME

Printer mobydick special instructions for group aog
lp -d mobydick -o upper $FILENAME

D. PRINTING FROM HP-UX
======================
NOTE: No spaces are allowed between switches and arguments of the lp
command. (We use the double quoting mechanism and pad a space to
satisfy the Solaris syntax required on our Sun print spooler.)

1. PAPER OUTPUT – 8.5" X 11"
lp -d$PRINTERNAME $FILENAME
e.g.
lp -draphael myfile

2. TRANSPARENCIES (available printers: raphael, klee)
lp -d $PRINTERNAME -o" tray2" $FILENAME

3. DUPLEX printing (available printers: raphael, klee, pokey, mumbo, adams)
lp -d $PRINTERNAME -o" duplex" $FILENAME

4. 11" X 17" (available printers: raphael, mumbo, adams and orozco)
SINGLE SIDED
lp -d $PRINTERNAME -o" 11x17" $FILENAME

2 SIDED
lp -d $PRINTERNAME -o" 11x17" -o" duplex" $FILENAME

For 2 pages of 8.5x11 on 11x17 paper, 2 sided:
lp -d $PRINTERNAME -o" 11x17" -o" tumble" $FILENAME

Printer mobydick special instructions for group aog
lp -d mobydick -o" upper" $FILENAME

E. CHECKING THE STATUS OF A PRINT JOB
Use the lpstat command. See the appropriate man pg for your platform as
Sun's and HP's implementation differ:
man lpstat

F. CANCELLING A PRINT JOB
Use the cancel command; see the appropriate man pg for your platform:
man cancel

G. BUGS AND UNRESOLVED HP PRINTING ISSUES
=========================================
1. Even though the above commands will work, when you print you may get
email similar to:
encountered an error while printing on printer $PRINTERNAME.

Please ignore this message.

2. If you check the status of your print job with the lpstat command
you may receive a disconcerting response like:
status being received is corrupt

Please ignore this message as the output will usually complete
without problems.