Printing on Unix/Linux hosts
This is a brief overview of how to print on Unix/Linux systems. For additional information on some of the commands mentioned, see the man page (i.e. run: man program) for that program. Many Unix programs will look for a "PRINTER" environment variable when determining a default printer, and you may wish to set this variable in your .login to a printer that is near you.
Historically, there have been two primary ways to print under Unix/Linux, the BSD and System V printing systems. Some commonly-used commands in each system:
- BSD printing commands:
- lpr to print.
- lpq to check printer status.
- lprm to remove a job from a print queue.
- Kerberized equivalents to BSD printing commands:
- klpr to print.
- klpq to check printer status.
- klprm to remove a job from a print queue.
- System V printing commands:
- lp to print.
- lpstat to check printer status.
- cancel to remove a job from a print queue.
The BSD commands are the default commands on Linux hosts, and are available in the directory /usr/ucb on Solaris hosts and /usr/bsd on IRIX hosts.
The System V commands are the default commands on Solaris and IRIX hosts.
There is also a set of Kerberized BSD printing commands available on every Facilitized Unix host.
Using BSD printing commands
See the Unix man entries for these commands for additional usage information.
To print a file to a printer
lpr -Pprinter file
To check the status of a printer
lpq -Pprinter
To remove a print job
lprm -Pprinter job-id
Using System V printing commands
See the Unix man entries for these commands for additional usage information.
To print a file to a printer
lp -d printer file
To check the status of a printer
lpstat -p printer
To remove a print job
cancel job-id
The cancel command also provides several other options for cancelling print jobs. The job-id is the one printed by lpstat, not the "request id" printed out by the lp command.
Kerberized BSD printing
The commands klpr, klpq, and klprm provide Kerberized equivalents to the BSD printing commands. These commands also support some additional options. For example, the command:
klpr -Pprinter@host file
would print the given file to the given printer, where host is that printer's spooler host. This can be useful if the remote printer is not in your /etc/printcap.
Other printing commands
One can use the enscript command to print formatted output of ascii files. See the man page for the extensive argument list.
The psnup command can perform transformations on Postscript files, such as rotating pages and printing multiple pages of a document on a single sheet of paper. pslpr is another program that can perform some transformations on Postscript.
Related documentation
- Unix/Linux support
- About Unix/Linux support in the SCS environment.
No comments:
Post a Comment