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.

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@hostfile

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.