Unix Printing

The C.S. department supports many printing options: various printer brands and models, a variety of software; color; and versatile copiers that support printing, scanning, and e-mail transmission. This page describes some of these options, and how to utilize various printing features. Please also see the Printer List and Drivers page.

In this page:

Printing System: CUPS (and LPRng)

For many years, the C.S. department used LPRng as the primary printing system; especially with the Solaris OS. Due to a reduction of support and development for LPRng, we have transitioned the printing system to CUPS (Common Unix Printing System).

Historical note: Two primary printing systems evolved in different development branches of the Unix operating system. LPRng is an extension of the LPR family of commands that are common in the Berkeley (aka, BSD) branch. CUPS is styled on the lp family of the AT&T System V branch.

CUPS provides partial support for the LPR command syntax style, thus providing two sets of commands; e.g., lp and lpr. We've removed most of the LPRng discussion from this document, but some remains as context for people who are more familiar with that system.

Common print system commands
CUPSLPRfunction
lplprsend a print job
cancellprmcancel (remove) a print job
lpstatlpqcheck status of print jobs and queues
lpoptions-set or check printer options

Please see the appropriate man pages for command details. For example, in a terminal window, you can type, “man lpstat” to view the manual page for the lpstat command.

Printers and Command Basics

In general, our printers are named for the room number (and building) where they are located; they are listed in the table below.

The lp and lpr commands are the most basic way of sending print jobs (files, documents, etc.) to a printer. In many instances, printing may be initiated directly from an application running on your workstation, with options selected via a dialog window. For Windows, more information is available in the Windows printing FAQ. For information about printing from the wireless network, please see the wireless printing instructions for Mac or Windows. When possible, please try to print in duplex mode (both sides of the sheet) to save paper - this is generally the default setting.

To remove a print job, use the cancel or lprm commands. To check on the status of a print queue, use the lpstat or lpq commands.

Queue names*LocationUseModes*E-Mail**
colorpr108cinside D108 LSRCPUBLICsx,dx,raw
eprint *** at D101 (lobby) LSRCPUBLIC -
101 ***pr101at D101 (lobby) LSRCPUBLICsx,dx,raw-
108cpr108cinside D108 LSRCPUBLICsx,dx,raw
109pr109outside D109 LSRCPUBLICsx,dx,raw-
112pr112ainside D112 LSRCPRIVATEsx,dx,raw-
128pr128outside D128 LSRCPUBLICsx,dx,raw-
129pr129D129 (hall copier) LSRCPUBLICsx,dx,raw
204pr204ainside D204 LSRCPRIVATEsx,dx,raw-
214acpr214acinside D214A LSRCPRIVATEsx,dx,raw-
211cpr211coutside D211 LSRCPUBLICsx,dx,raw-
230pr230outside D230 LSRCPUBLICsx,dx,raw-
231pr167D231 (hall copier) LSRCPUBLICsx,dx,raw
234pr167in D231 corridor, outside D234 LSRCPUBLICsx,dx,raw-
312pr312outside D312 LSRCPUBLICsx,dx,raw-
adminpr312ainside D312 LSRCPRIVATEsx,dx,raw-
315apr315ainside D315 LSRCPRIVATEsx,dx,raw-
315cpr315cinside D315 LSRCPRIVATEsx,dx,raw-
331pr331outside D331 LSRCPUBLICsx,dx,raw-
332pr152D332 (hall copier) LSRCPUBLICsx,dx,raw
020pr020inside N020 NorthPUBLICsx,dx,raw-
022pr022inside N022 NorthPUBLICsx,dx,raw-
141robot-lab-printerinside N141 NorthPUBLICsx,dx,raw-
224npr224ninside N224 NorthPUBLICsx,dx,raw-
311npr311ninside N311 NorthPUBLICsx,dx,raw-
311ncpr311ncinside N311 NorthPUBLICsx,dx,raw-
3245fpr3245finside N3245 FrenchPUBLICsx,dx,raw-

* NOTE: For CUPS-style commands, usually a -d (destination) option is used, e.g., “lp -dqueuename”; but sometimes it's -p, so please check documentation. For LPRng-style commands, printers can generally be selected via a -P option, e.g., “lpr -Pqueuename”.

The queue names listed above can be modified by appending modes to the end with a dash (see below). The available modes are:

  • sx = simplex (single-sided)
  • dx = duplex (double-sided), the default
  • raw = raw, do not force paper tray, size, etc

In most cases, the bare queue name (no -mode appended) is equivalent to -dx. You can also customize your own queue names using the lpoptions command.

On the HP4730MFP and HP4650DTN (color printers), -ut (uppertray) and -tr (transparency) are equivalent.

On the HP4050TN, -ut (uppertray) and -lh (letterhead) are equivalent.

***NOTE: The color printers require special transparencies, which can be obtained from the Lab Secretary in D128. Do not use unapproved transparencies or paper in these printers! Other non-approved transparencies will melt in the printer and cause damage; i.e., they will not work!

**NOTE: These printers / copiers can scan and send the document as e-mail.

***NOTE: The eprint printer is primarily managed by OIT. It can be accessed via the ePrint system, and is one of a pool of campus printers that can print any ePrint job using DukeCard authentication. You can also print to this printer directly via the local 101 queue.

lp -d101 myfile lp -Unetid -deprint myfile

In the first example above, the print job is sent directly to the printer via the local queue. In the second example, the job is sent to an OIT ePrint server, and can be retrieved from any ePrint printer on campus. Note that for eprint, if your CS username is different than your Duke NetID, then you must include the -U{NetID} option; it might not be possible to do this through most GUI print dialogs!

Command Examples

Printing:

lpstat -a

Sho

lpstat -a

show all printers

lp -d331-sx myfile

will cause your job to be printed single-sided on printer 331.

lpr -P128-dx yourfile

will cause your job to be printed double-sided on printer 128.

lpr -P020-raw -o 'inputslot=tray1' herfile

will result in a manual feed request on printer 020.

lp -d108c-raw -o 'duplex=none inputslot=tray1 hpstapleroptions=1angled' somefile

will result in a single-sided, manual-feed, stapled request on color printer 108c.

It is a good idea to use environment variables to hold the queue name of the printer that you use the most. That way, you do not have to type the -d or -P option when using that printer. For example, put this line in your .my-cshrc file:

setenv LPDEST 022-dx # for CUPS setenv PRINTER 022-dx # for LPRng

Alternatively, you can use lpoptions -d queuename to designate your default printer.

Displaying queued print jobs:

lpstat -o

will show all jobs queued on all printers

lpstat -o 022-dx

will show all jobs in the 022-dx queue

lpq

will show jobs in your default queue

lpq -a

will show all jobs in all queues

lpq -P331-raw

will show all jobs in the 331-raw queue

Cancelling a print job:

A CUPS print job has a job ID that is either a number or 'queue-number'. You will need to run lpstat or lpq to list queued jobs, then use one of cancel or lprm to cancel one or more print jobs.

cancel 128-dx

will cancel your top job in the 128-dx queue

cancel 128-dx-12345

cancel 12345

these will cancel the print job with job ID 12345

lprm

will remove your top job in your default queue

lprm 12345

will remove your job with job ID 12345

lprm -P020

will remove your top job in the 020 queue

CUPS Options

CUPS provides two ways to select print options, i.e., when using commands and not an applicaiton dialog window. There's command-line selection via lp's and lpr's “-o” option. There's an example above in the Printers and Command Basics section.

Then there's setting options and creating instances with the lpoptions command. Let's say that your default printer is 109, and you always like certain features (options) set. You could set the defaults with something like “lpoptions -p 109 -o 'opt1=val1 opt2=val2 ...'”. Then, when you print to “lp -d 109”, your default options will automatically be used. If you also want a printer queue that has an alternative option, say you want simplex instead of duplex, you could create an instance with “lpoptions -p 109/sx -o 'duplex=none opt1=val1 opt2=val2 ...'”. You could then select this queue using “lp -d 109/sx”.

To get more information about the options available on a particular printer, use “lpoptions -l -d printername”, or contact the Lab Staff.

LPRng “Z” Options

Additional options are available via lpr's -Z flag. As with printer “modes”, availability of these options depends on a particular printer's capabilities.

Some of the options that are available on the HP4050N printers are:

300300 dpi resolution, draft quality
600600 dpi resolution (default)
12001200 dpi resolution, very high resolution
fastres(1200 dpi only) full speed printing
fastresoff(1200 dpi only, PRORES) highest resolution, slower printing
economodeuses less toner (default)
economodeoffuses more toner
simplexsingle-sided (default)
duplexdouble-sided
portraitvertical orientation (default)
landscapehorizontal orientation

Additional options on appropriate printers:

letterheadletterhead tray
transparencytransparency tray
manualmanual feed tray
staplestaple sheets

Multiple Z options can be selected by separating them with commas, for example:

lpr -Z300,landscape,duplex somefile

It is impractical to try to list all options for all printers here. Using an option not applicable to a printer simply causes that option to be ignored, so it doesn't hurt to experiment. For information on particular printers, try checking the web site for that printer manufacturer, or contact the Lab Staff.

Conversions

Our printing system can handle quite a few types of data conversions automatically. Give it a try. If it can't print your document, you will usually get an error message. For example:

lp -d 312-dx FinalReport.pdf.gz

NOTE: Currently, Microsoft formats (e.g., Word documents) are not supported; you will need to first convert (export) to a supported format such as PS or PDF.

PDF's and Unusual Paper Sizes

Unfortunately, printing PDF's with page sizes other than letter will not usually transpire transparently; additional steps will probably be required. For example, to print a legal size file.pdf to printer 211,

acroread -toPostScript -size legal < file.pdf > file.ps lpr -P211-raw -o 'inputslot=tray1 media=legal' file.ps

Note that the -raw queue is needed here to override some enforced defaults.
For more information on acroread options, type acroread -help.

Saving Paper: Printing N-Up; Using Copiers

In addition to printing in duplex mode (see above), you can save lots of paper and wear-and-tear on the printers by printing “N-up.” This means that you reformat the print job to print 2 (2-up) or more reduced-size pages per physical page. For text files, this can be done with the enscript command, for example:

enscript -2r -P211 joesfile

For PostScript, use either of mpage or psnup.

psnup -2 {filename.ps} | lp -d 020 {some command} | mpage -2Sto -P128-dx

(mpage can also handle plain text.)

Also, when making multiple copies of a document, please use one of the copiers (see the printer table above). Each page printed on a printer costs around twice as much as a page printed on a copier.

Contact: