Main navigation | Main content
To print from a Unix machine, use lpr or mpage at the command line to print postscript (.ps) and text files. Neither lpr nor mpage will print PDFs, .doc files, or other application documents correctly. In most cases, garbled code will be printed instead of the text or pictures intended. Use the application which created the document to print a postscript file before printing.
"mpage" will allow you to print multiple pages on each sheet of paper and provides additional formatting options. It defaults to 4 pages/sheet. More mpage formatting options can be found by typing "man mpage" at the command line. Note that several options for mpage (including -P) do not permit a space between the option and its argument.
Usage:
lpr -P<printer name> <filename> mpage -<# pages/sheet> -P<printer name> <filename>
Examples:
lpr -Pprinter1 myDoc.ps mpage -2 -Pprinter1 csciNotes.ps
Black and white printers print duplex (double-sided) by default. In most cases, to print simplex (single-sided) pages you need to append '-simplex' to the end of the printer name.
Usage:
lpr -P<printer name>-simplex <filename> mpage -<# pages/sheet> -P<printer name>-simplex <filename>
Example:
lpr -Pprinter1-simplex myDoc.ps mpage -4 -Pprinter1-simplex csciNotes.ps
If you are printing to one of the Xerox 3450s and the above command does not work, use:
lpr -Z simplex -P<printer name> <filename>
Color printers print simplex (single-sided) by default. To print duplex (double-sided) append '-duplex' to the end of the printer name.
Example:
lpr -P<printer name>-duplex <filename>(back to top)
lpq -P<printer name>
This will produce output that similar to the following:
Printer: grad is grad-queue@printhost Printer: grad-queue@augustus-239 'HP LaserJet' Queue: 1 printable job Server: pid 4030 active Unspooler: pid 4045 active Status: printing 'username@mega+244', file 1 '/etc/motd' Filter_status: sending job Rank Owner/ID Class Job Files Size Time active username@mega+244 A 244 /etc/motd 54 09:14:39
Find the Job Number. (In this example, it is 244.)
lprm -P<printer name> <Job Number>(back to top)
Unless a default printer has been set for your account, most Linux and Unix applications will default to the printer "grad", located in Keller Hall 2-216 (the Grad Lab).
To set a default printer, you need to modify the shell configuration file in your UNIX home directory. This will most often be your '.cshrc' file.
Just add the following line to your .cshrc file. Then log out and log back in.
setenv PRINTER <printer name>
Tip:
To set a different default printer on different machines, you can add tests of this format to the configuration files:
if ( `uname -n` == <host1>) then
setenv PRINTER <printer1>
else
setenv PRINTER <printer2>
endif
(back to top)
Click File -> Print... and select 'Print to LPR'. Enter the lpr print command without a filename in the Command Line prompt.
Usage:
lpr -P<printer name>
Example:
lpr -Plind24
Click File -> Print... and in the command prompt to the right of Custom... enter the lpr print command without a filename.
Usage:
lpr -P<printer name>
Example:
lpr -Plind24
Click File -> Print... and select a printer from the pull-down menu next to 'Name'.
gedit does not support 'Print to LPR' at this time. Instead click File -> Print... and select 'Print to File'. Enter a filename and select 'Postscript' as the type. Then close or minimize gedit and print the file from a command line.
Usage:
lpr -P<printer name> <filename>
Example:
lpr -Plind24 filename.ps