UMIACS uses the LPRng spooling system to provide both a Berkeley UNIX interface to our network printing system.
The commands are located in /usr/local/bin. They include the programs 'lpr', 'lprm', 'lpq', and 'lpstat'.
All of the UNIX queues are configured to handle postscript. See the examples section for more information on how to print different file types. Basic Commands
Use `lpr -Pprintername filename.ps` to submit the postscript file named filename.ps to the printer queue named printername. If no filename is specified, lpr reads from standard input. If no printer name is specified, then the job is discarded by the print server.
Additional options to specify media handling, page orientation, and double sided printing can be passed to the print spooler using one or more -Z options. Double sided printing is specified with -Zduplex. Page orientation is controlled with -Zportrait, -Zlandscape. Manual feed media (eg. transparencies) is specified with -Zmanual. Please note that not all printers support all -Z options.
Use `nscript -Pprintername filename.txt` to send the text file named filename.txt to the printer named printername. If no filename is specified, then nscript reads from standard input.
Nscript is a weak attempt to simulate Adobe Systems Incorporated nscript programs. It supports a handful of interesting arguments. With the '-G' argument, nscript generates gaudy output that includes header information on each page. The '-2' argument generates two column output and '-r' rotates the job's orientation to landscape mode.
Use 'lprm -Pprintername' to remove jobs from the queue named printername. With no further arguments, it removes the first removable job in the queue. Given a job's id as an argument, it will remove the specified job from the queue and you can remove all removable jobs from a queue with the argument "all".
You are able to remove items from the queue that you have submitted from anywhere, not just the computer from which the job was submitted.
Use 'lpq -Pprintername' to get the status of the queue named printername. With no further arguments, it will print the printer queue, the host queried, and the number of jobs in the queue. With the -l argument, it will specify the id, queue rank, the total size of the job in bytes, and any errors encountered in processing the job.
Postscript is a Page Description Language that is understood by high quality printers and typically generated by applications. There is a lot of documentation about using and programming in postscript, but for our purposes you'll just need to generate postscript from an existing text file.
You can generate postscript from an existing text file with textps. For example, to convert the Message of the Day file to a postscript file try `textps ... > file.ps`.
Preview your job
It's helpful to preview your postscript files before printing by calling Ghostview with `ghostview file.ps`.
Higher quality previewing is available using Ghostview's derivativegv. You can call it as `gv file.ps`.
Both commands should open a window that displays the contents of your postscript file.
Choose a print queue
Print queues are described here: Print Queues.
You can check list all the print queues with `lpq -a` and you can list just a single queue `lpq -Pprintername` -- eg. ps432-3208 with `lpq -Pps432-3208`.
Send a print job
After you choose a suitable printer (eg. ps432-3208), you can send your postscript file to the printer with `lpr -Pps432-3208 file.ps`.
Monitor a print job
You can monitor the job you sent to the printer (eg. ps432-3208) with `lpq -Pps432-3208`.
Lpq will return the following output:
[herzog 33] lpq -Pps432-3208 Printer: ps432-3208@lpr1 (dest email@example.com) 'HP M653 in IRB 3208' Queue: 2 printable jobs Server: pid 11833 active Unspooler: pid 11837 active Status: waiting for subserver to exit at 14:50:45.141 Rank Owner/ID Class Job Files Size Time active fmccall@herzog+198 A 198 file.ps 4309 14:50:44 2 bargle@prime+199 A 199 hpss.ps 4309 14:50:45 Active connection from 184.108.40.206 Waiting connection from 220.127.116.11
Remove a Print Job
If you would like to remove your job from the queue, you should get the job's id from the output of `lpq`. You can remove it with `lprm -Pps432-3208 198`
From the output of lpq, I can see that the job id is 198 and I can remove it with lprm as follows:
[herzog 35] lprm -Pps432-3208 198 Printer ps432-3208@durer: checking perms 'fmccall@herzog+198' dequeued 'fmccall@herzog+198'
Often the last job listed in the printer queue has already spooled to the printer, and lprm will be unable to delete the job. In this case, the only way to cancel the job will be to press the 'cancel' button on the printer.