UNIXPrinting: Difference between revisions
No edit summary |
|||
(4 intermediate revisions by 3 users not shown) | |||
Line 13: | Line 13: | ||
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. | 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. | ||
==nscript== | ==nscript== | ||
Line 22: | Line 20: | ||
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. | 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. | ||
== | ==lprm== | ||
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. | |||
==lpq== | |||
lpq | |||
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. | 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. | ||
==Generate Postscript== | ==Generate Postscript== | ||
Line 56: | Line 46: | ||
==Choose a print queue== | ==Choose a print queue== | ||
Print queues are described here: [[PrinterQueueNaming | Print Queues]]. | |||
You can check list all the print queues with `lpq -a` and you can list just a single queue `lpq -Pprintername` -- eg. | 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== | ==Send a print job== | ||
After you choose a suitable printer (eg. | 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== | ==Monitor a print job== | ||
You can monitor the job you sent to the printer (eg. | You can monitor the job you sent to the printer (eg. ps432-3208) with `lpq -Pps432-3208`. | ||
Lpq will return the following output: | Lpq will return the following output: | ||
[herzog 33] lpq - | [herzog 33] lpq -Pps432-3208 | ||
Printer: | Printer: ps432-3208@lpr1 (dest raw@ps432-3208.umiacs.umd.edu) 'HP M653 in IRB 3208' | ||
Queue: 2 printable jobs | Queue: 2 printable jobs | ||
Server: pid 11833 active | Server: pid 11833 active | ||
Line 77: | Line 67: | ||
Status: waiting for subserver to exit at 14:50:45.141 | Status: waiting for subserver to exit at 14:50:45.141 | ||
Rank Owner/ID Class Job Files Size Time | Rank Owner/ID Class Job Files Size Time | ||
active | active username@herzog+198 A 198 file.ps 4309 14:50:44 | ||
2 | 2 username2@prime+199 A 199 hpss.ps 4309 14:50:45 | ||
Active connection from 128.8.120.247 | Active connection from 128.8.120.247 | ||
Waiting connection from 128.8.120.247 | Waiting connection from 128.8.120.247 | ||
Line 84: | Line 74: | ||
==Remove a Print Job== | ==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 - | 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: | 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 - | [herzog 35] lprm -Pps432-3208 198 | ||
Printer | Printer ps432-3208@durer: | ||
checking perms ' | checking perms 'username@herzog+198' | ||
dequeued ' | dequeued 'username@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. | 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. |
Latest revision as of 15:46, 7 May 2021
Introduction
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
lpr
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.
nscript
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.
lprm
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.
lpq
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.
Generate Postscript
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 raw@ps432-3208.umiacs.umd.edu) '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 username@herzog+198 A 198 file.ps 4309 14:50:44 2 username2@prime+199 A 199 hpss.ps 4309 14:50:45 Active connection from 128.8.120.247 Waiting connection from 128.8.120.247
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 'username@herzog+198' dequeued 'username@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.