Guide to UNIX Printing
There are four general purpose network printers available for UNIX printing. Their location, description and print queue names are listed below.
| LOCATION |
DESCRIPTION |
QUEUE NAME |
| Room 135, Soc/Psych - PC cluster
| HP LaserJet 5Si MX - 24 ppm
| clus
|
| Room 258, Soc/Psych - 2nd floor copy room
| HP LaserJet 4100 - 26 ppm
| copy2 (default)
|
| Room 330MR, Soc/Psych - 3rd floor copy room
| HP LaserJet 5M - 12 ppm
| copy3
|
| Room 014, Languages - graduate student office
| HP LaserJet 4Si - 17 ppm
| lang
|
By default, all UNIX printing is directed to the printer located in the second floor copy room. This includes the following common types of output:
- Email messages printed from pine
- Statistical output printed from interactive sessions
- Files printed with lpr and enscript commands
If you wish to permanently alter the default network printer to which all of your output is sent, please indicate to Bob Jackson which printer you would like to become your new default. [Be aware that the convenience of alternate printers must be weighed against the lesser vigilance with which other printers are monitored and output is organized and secured.]
Control of Printed Output with lpr and enscript Commands
The lpr and enscript commands are used to send files to a printer. The lpr command sends output without altering it. If the file is text, then text is printed. If the file is stored in a graphical or PostScript format, lpr directs it to the printer in that format and the printer attempts to handle it. Some examples of the use of lpr are:
- Print a text file to the default printer: lpr note.txt
- Print a text file to a designated printer (in this case the one in Room 135):
lpr -Pclus note.txt
- Print a copy of the cat command manual page by piping it to lpr:
man ls | lpr
- Print a PostScript file (such files usually have a .ps extension):
lpr graph2.ps
Note: if a PostScript file fails to print when directed to the printer in this fashion (usually only a banner page comes out when this occurs), try directing it to the printer with an alternate form of the above command where you designate the printer specifically and append a "ps" to the name of the printer. This will send the output to an alternate internal queue within the designated printer that often produces better results.
lpr -Pcopy2ps graph2.ps
In the above example the printer name is changed from "copy2" to "copy2ps". The same technique can also be used when trying to print web pages from UNIX Netscape that refuse to print. For example, when you select the print option under Netscape, a print dialog box appears which by default directs your output to "lpr" (your default printer). This specification may be modified as follows:
lpr -Pcopy2ps
The enscript command is used to convert text into PostScript formatted output which is then directed to the printer. This allows for labeling, indention, font control, landscape printing, multi-column printing and other variations which add to the flexibility and convenience of output preparation. Output from interactive UNIX SAS sessions, for example, is configured to print by default using enscript landscape, 2-column printing. Following are some examples of the use of enscript:
- Print named file to the default printer:
enscript note.txt
Each page of output will contain a bold header that contains the filename, the date, the time and a page number.
- Print named file to a specific printer (copy3 from above table):
enscript -Pcopy3 note.txt
- Print two copies of named file:
enscript -n2 note.txt
- Print named file with left indention 8 characters more than normal:
enscript -i8 note.txt
- Print named file with fancy headers:
enscript -G note.txt
- Print named file without headers:
enscript -B note.txt
- Print named file in landscape mode:
enscript -r note.txt
- Print named file in landscape mode with two columns per page:
enscript -2r note.txt
- Print named file in landscape, 2-column mode with fancy headers to a designated printer:
enscript -2rG -Pclus note.txt
- Print two files with one enscript command:
enscript -2rG regress2.lst regress2.out
- Print using Times-Roman 9 point font:
enscript -fTimes-Roman9 note.txt
Both font and point size may be controlled. The default font for portrait printing is Courier 10 point (a mono-spaced font where each character occupies the same amount of space). The default for (-2r) landscape, two column printing is Courier 7 point.
- Print using N-up printing - in this case 4 logical pages are printed per physical sheet in a condensed font, which is useful in some instances for creating archival copies of large documents:
enscript -U4 codebook.txt
- Print selected pages of named file:
enscript -a 4-7 note.txt [pages 4-7]
enscript -a -9 note.txt [first to ninth page]
enscript -a 6- note.txt [sixth to last page]
enscript -a odd note.txt [odd pages only]
enscript -a even note.txt [even pages only]
You may combine several of the above illustrated options to produce tailored printing effects. For full discussion of enscript, see the enscript man page. Note that if you apply the enscript command to a file that contains PostScript language, you will get a listing of the PostScript code, which is probably not what you want.

Last Updated September 18, 2002
Bob Jackson