This guide is for help with printing in linux. The first section describes ways to select a printer through the GUI. The rest describes command-line printing. If you're trying to add a printer to your personal linux machine, please read this.
(For the basic command lines, see the printing section of the Unix Quick Reference.)
If you're currently logged into a machine on the console (i.e. - You're sitting at the computer), then you can select which printer you want from any application. Simply go to the application, select File → Print (cntl-p), then you'll be able to select from any of the printers in the department. For printing files from the command-line, see the following sections.
The command to use for printing to our network-attached printers is lpr. This is for printing from the command-line on our Linux machines.
Our dotfiles can currently figure out if you are currently in the Hydra or Cetus labs and will choose the appropriate printer automatically. However, you can still set your own default printer. Edit your .zshrc file and find this section:
# set up printing
if [[ "`/bin/uname -n`" == cetus* ]]; then
export PRINTER="cetus"
elif [[ "`/bin/uname -n`" == hydra* ]]; then
export PRINTER="hydra"
fi
# export PRINTER="clxxx"
If you want to set your own default printer, remove the comment (the # sign) from the last line and change clxxx to the name of your new default printer. To see the list of available printers, go to http://printing.eecs.utk.edu:631/printers. The naming scheme for the printers is “clXXX” for printers in Claxton and “fXXX” for printers in Ferris. The XXX is the room number of the printer. There may also be an optional letter at the end of the name, such as cl203h. This is merely to differentiate printers which have the same room number. If you are looking for a commonly used printer, you may want to go to http://printing.eecs.utk.edu:631/classes. This contains a list of printer aliases. For instance, “cetus” is an alias for “cl103”, which is the printer in the cetus lab.
If you want to print to a specific printer other than your default printer, you can specify it on the command line. Add a -P<PRINTER> option to your lpr (manual page) command, where <PRINTER> is the name of the printer you wish to use. For example:
lpr -Pcl203h test.txt
will print the file test.txt to the printer named cl203h.
Perhaps you'd like to print a file in a slightly non-standard way from the command-line. The ”-o” option for the lpr allows you to pass printing options to the printer, in a space-separated list. For instance, perhaps you'd like to print on both sides of the paper, or print in landscape mode. This is the list of options that the lp suite of tools accepts, taken from the lp(1) man page:
-o media=size
Sets the page size to size. Most printers support at least the size names "a4", "letter", and "legal".
-o landscape
-o orientation-requested=4
Prints the job in landscape (rotated 90 degrees).
-o sides=one-sided
-o sides=two-sided-long-edge
-o sides=two-sided-short-edge
Prints on one or two sides of the paper. The value "two-sided-long-edge" is normally used when printing portrait (unrotated) pages, while "two-sided-short-edge" is used for landscape pages.
-o fitplot
Scales the print file to fit on the page.
-o number-up=2
-o number-up=4
-o number-up=6
-o number-up=9
-o number-up=16
Prints multiple document pages on each output page.
-o scaling=number
Scales image files to use up to number percent of the page. Values greater than 100 cause the image file to be printed across multiple pages.
-o cpi=N
Sets the number of characters per inch to use when printing a text file. The default is 10.
-o lpi=N
Sets the number of lines per inch to use when printing a text file. The default is 6.
-o page-bottom=N
-o page-left=N
-o page-right=N
-o page-top=N
Sets the page margins when printing text files. The values are in points - there are 72 points to the inch.
For more options, such as printing multiple copies, check the lpr manpage.
Since most program code is simple ASCII text, you can print it without any further processing using the lpr command. However, using the enscript program, you can get much improved output and page usage when printing your code. First of all, we recommend that you read the manual page for enscript (man enscript) but here are some command lines you can use to get your program code (and other ASCII text files) to print nicely. By default, enscript will send its output directly to your default printer (see above for how to change it). However, you can use a -P option to select a different printer or even make the output go to a Postscript file. Assuming you are trying to print “code.c”, here are some useful command lines:
| Effect | Command | Output Sample |
|---|---|---|
| Print multiple columns | enscript --columns=2 code.c | |
| Print in landscape mode | enscript --landscape code.c | |
| Do syntax-highlighting | enscript --pretty-print --color code.c
| |
There are many other options explained in the manual page, for example –fancy-header which gives your text a useful header. You can combine these options to create efficient and attractive output of your code. For example:
# enscript --pretty-print --color --landscape --columns=2 --fancy-header code.c
(Read the man page for the equivalent short options, in this case: enscript -2rGE –color)
This produces very attractive and page-saving output:

There are many more options to enscript, including ways to change the font, create text borders, create line numbers, etc. Again, read the manual page for more information.
You can easily print multiple pages per sheet of paper. To do this, you must have a Postscript (PS) file of what you want to print or generate Postscript from a command and send it to a pipe. The command to use to print multiple pages per sheet is psnup (manual page). There are many options, so you should read the manual page (man psnup) for more information. The psnup command acts as a filter, meaning it takes a PS file as input and sends a new PS file to its output. To print this output file you can send it to a file using something like:
# psnup -4 input.ps > output.ps
and then print the output.ps file using an appropriate lpr command. However, if you have no interest in retaining the output PS file, just use a pipe like this:
# psnup -4 input.ps | lpr
Through the use of pipes you can generate some very useful output in one single command. For example, you want to print code.c with syntax highlighting, fancy header, four pages per sheet, and duplexed (double-sided). You can do this with the following single command:
# enscript --fancy-header --pretty-print --landscape --color -p - code.c | psnup -4 -l | lpr -Phydra -Z duplex
Note: The -l option tells psnup that your input is in landscape format. For more info, check the appropriate manual pages.

One good use for psnup is to use it to print PDF files two or for pages to a sheet of paper. Just select the “File” button when printing the PDF from Adobe Acrobat and then use psnup -4 | lpr to print that file (of course you can add additional options to psnup or lpr).