UNIX

5.0 Printing Files

5.1 lpr

The lpr program sends a file to a printer. When you use the lpr command, you must specify the printer, the name of the file you wish to print, and the output type of the file (the formatter you used, if any, to make the output file). In its simplest form, lpr is quite easy to use: type lpr fileneme and press RETURN, where fileneme is the name of the file to be printed. In this case, the file will be read, and its contents will be sent to the default printer. (See Section 5.4 for Wesleyan printer names and locations.)
When printing formatted text with lpr, the type of formatting should be indicated by the inclusion of command option flags. For a listing of these comands, use the man command (Section 8.0). One flag is worth noting here. Usually, you will prefer to print to a nearby printer, rather than to the default printer. The destination printer is specified by adding the flag -PprinterName where printerName is the device name of the preferred printer. Note the upper-case P. Also note that there is no space between the P and printerName. There are many printers across campus that are available for printing from UNIX. Printer names are usually posted on the printers themselves, but if you cannot find a printer name, refer to Section 5.3 for a list of the available printers (this info will be available shortly). For example, to print the file english1.dvi (a text file that you have formatted using TEX) on the printer its-hp5, type
lpr -Pits-hp5 -d english1.dvi
and press RETURN. its-hp5 in this example is a laser jet printer located in the science tower on the 5th floor. You should replace this name with the name of the printer you wish to use.

5.2 lpq and lprm

When lpr is called, printing jobs are placed in a queue. The contents of this queue may be viewed with the lpq utility, and a user may remove any of his or her jobs from the queue (and cancel printing) with the lprm command. To list the contents of the queue for the default printer, type lpq and press RETURN.
If you just sent the file english1.dvi to the printer its-hp5 and you want to see if it is in the queue, type lpq -Pits-hp5 and press RETURN. The lpq program will display a line of information about each print job in the printer's queue. (To obtain more detailed information about multi-file print jobs, use the -l flag: lpq -l.)
If you want to cancel the printing of your file(s) (remove from queue), type:
lprm -PprinterName yourLoginName
and press RETURN. This will remove all your print jobs from the specified printer queue.

5.3 Campus Printers, Locations, and Device Names

This list is coming soon. (see Section 5.1, "lpr")



Next Section Previous Section Contents