Department of Electrical Engineering and Computer Science



Linux Printing Guide

For basic linux commands, see the printing section of the Linux Quick Start Guide.

GUI Printing

If you're currently logged into a machine on the console, i.e. sitting at the computer, then you can select which printer you want from any application. Simply go to the application, select File → Print (Ctrl+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.

Basic Printing

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.

 

Setting Your Default Printer

Our dotfiles can currently figure out if you are currently in the Hydra lab and will choose the appropriate printer automatically. However, you can still set your own default printer. Edit your ".zshrc" file and find a section similar to:

# set up printing
elif [[ "'/bin/uname -n'" == hydra* ]]; then
export PRINTER="hydra"
fi
# export PRINTER="mkxxx"

If you want to set your own default printer, remove the comment (the # sign) from the last line and change "mkxxx" to the name of your new default printer. The naming scheme for the printers is "mk###" for printers in the Min Kao Building. The ### is the room number of the printer. There may also be a suffix, like -color for a color printer or -mfc for a multi-function copier/printer/scanner/fax.

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, "hydra" is an alias for "mk421", which is the printer in the hydra lab.

 

Setting the Printer on the Command Line

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 option to your lpr command, where is the name of the printer you wish to use. For example:

lpr -Phydra test.txt

will print the file test.txt to the printer named hydra.

 

Setting Printer Options on the Command Line

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 out the lpr command.

 

Advanced Linux Printing

For more advanced printing techniques, like printing program code, check out our Advanced Linux Printing page.


 

The University of Tennessee, Knoxville. Big Orange. Big Ideas.

Knoxville, Tennessee 37996 | 865-974-1000
The flagship campus of the University of Tennessee System