[Chapter 43] 43.4 Using Different Printers
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-10-23T15:51:43Z

#

| Chapter 43 Printing |

## 43.4 Using Different Printers

Each printer on your system should have a name. By default, commands that send a file to a printer assume that the printer is named lp-which probably stands for "line printer" (though it could stand for "laser printer"). If you're using a single-user workstation, and have a printer connected directly to your workstation, you can name your printer lp and forget about it.

However, in most environments, there are more options available: e.g., there are several printers in different parts of the building that you can choose from. Often, only one printer will be able to print your documents: you may need to send your print jobs to a PostScript printer, not the line printer that the accounting department uses for billing.

There are two ways to choose a printer:

- Printing commands that originate with BSD UNIX accept the option `-P` `printer`. This includes lpr (43.2), various scripts to format typeset documents, etc. For example, `lpr -Pps file.ps` sends the file file.ps to the printer named ps. (By the way, ps is probably the second most common printer name, after lp.)

- Commands that originate with BSD UNIX recognize the PRINTER environment variable (6.1); if PRINTER is defined, the command will read its value and choose a printer accordingly. So the command:

  >     % setenv PRINTER ps  - or
  >     $ PRINTER=ps ; export PRINTER

  ensures that the BSD print commands will send your documents to the printer named ps.

- Commands that originate with System V UNIX (such as lp) use the -d option to select a printer. So `lp -d pr file.ps` sends file.ps to the printer named pr; it's equivalent to the previous lpr example.

- Commands that originate with System V UNIX look for an environment variable named LPDEST, rather than PRINTER. So:

  >     % setenv LPDEST ps  - or
  >     $ LPDEST=ps ; export LPDEST

  ensures that the System V print commands will send your documents to the printer named ps.

Note that System V Release 4 includes both the System V and BSD print commands (lp and lpr). This can make things confusing, particularly if you're using a script to process troff or TeX documents, and that script automatically sends your documents to the printer. Unless you know how the script works, you won't know which variable to set. I'd suggest setting both PRINTER and LPDEST.

By the way, if you only have one printer, but you've given it some name other than lp, the same solution works: just set PRINTER or LPDEST to the appropriate name.

- ML

43.3 Printer Control with lpc |  | 43.5 Using Symbolic Links for Spooling