How do I print from Unix and Linux?
For general information on using SEAS printers, please see:
Command Line Printing
If you're logged into a unix server or linux terminal, you may print text
files or postscript files using the
lpr command to print to the
default printer, the Levine 164 queue. For example, to print a
text file called
hrsprn, type this command:
If you would like to print to a different printer in the system, follow the
lpr command with
-P followed immediately by the name of the printer.
For example, to print the
hrsprn file to the Towne
M70 queue, type this command:
lpr -PPay-to-print_M70 hrsprn
Similarly, you may print to Levine 164 by typing:
lpr -PPay-to-print_169_Color hrsprn
lpr command also accepts files in the Postscript format. Do
not attempt to print non-text or non-Postscript files, though, because this can
cause the printer to malfunction. See below for some printing solutions for
other file types.
If you would like to print an image file from Unix or Linux, you will need
to open the file in an imaging program. If the file is of a common internet
format, such as GIF or JPEG, it is probably easiest to use the your browser to
open the image and print it. Otherwise, the
xv program should be
used. XV is a program written by Penn's own John Bradley, and is widely used to
manipulate images in Unix and Linux. To print the image, simply open it in XV,
and hit the print button. You'll notice that the print dialogue box allows you
to change the print command.
Save Paper by Compressing Output
To help conserve paper, we recommend that you try one of the available print compression programs available on Eniac.
mpage command is the fastest and most simple way to save
paper on Eniac. To print the file
hrsprn so that four pages are
printed on a single sheet of paper, type:
This will cause the document to be printed on the default printer in the CETS office. If this is too small to read, and you want to sent it to the printer in Towne M70, use this command:
mpage -2 -PPay-to-print_M70 hrsprn
In this command, the
2 represents the number of pages of text
to print per sheet of paper, and the
P129 represents the name of
the printer using the same syntax as the
lpr command. For more
man mpage at the Eniac command prompt.
enscript command works basically the same way as mpage, but
is much more customizable. For information on using enscript, type
enscript at the command prompt. NOTE: Enscript only
works on text files, whereas Mpage works on both text and postscript files.
Compressing Internet Printouts
As described above, web browsers allows you to change the command it uses to print files. This functionality makes it possible to compress internet printouts. You can do this by clicking on "File", selecting "Print...", and replacing the lpr command with the print protocol you would like to use. For example, if you would like to use mpage to print four pages of text per sheet of paper, click on the box and replace:
Most text data can be printed by using a pipe (|) in Unix or Linux. This is performed by placing a pipe at the end of a command and following it with the "lpr" command. For example, to print a listing of the current directory to the printer in Towne M70, enter the following command:
ls | lpr -PPay-to-print_M70
If you have a very large directory listing, and you would like to use the comprehensive listing (-l) option of the directory, you can pipe to the mpage program to compress it to six pages per sheet of paper by entering this:
ls -l | mpage -6
Change the Default Printer
If there is a printer that you plan on using more than the default one in the CETS office in Levine 164, it may be in your best interest to change your default printer. To do this, add the following lines to the end of your ".bashrc" file:
printername to the name of the printer you want
to be your default. For example, to set your default printer to the Towne M70
queue, the line in your
.bashrc file should read:
After you save this to the file, changes will not take effect until the next time you log in. So log off and log back in to use the new printer.