[Next] [Previous] [Up] [Top] [Contents] [Index]

Chapter 8: Printing

8.1 The FUE Print Command: flpr

The Fermilab print utility flpr (pronounced "flipper") implements the lpd printing protocol, and can be used to print UNIX files to any print server using this protocol, including VMS print queues and most UNIX systems. Related commands are flpq (to check the print queue) and flpk (to kill a submitted print job; not supported on many hosts). The format of each command is:

% flpr [options] [file] ...
% flpq [options] [users|jobs] ...
% flpk [options] [users|jobs] ...

The options are described in the man pages. All three programs will display a list of their options when given an argument of -\?. Which options actually function depends on the functions supported by the lpd host.

The following command produces the version of flpr in use, when and where it was created, the flpr defaults in effect, and the command format:

% flpr -\? -v

To print a file, generally you will just need to enter the following:

% flpr -q queue file

This assumes that your implementation of flpr uses FNPRT.FNAL.GOV as the default host computer (most do), and that your printer is known to FNPRT (most are). If the -q option is not specified, the queue is taken from (in order of precedence):

  1. environment variable FLPQ
  2. user control file (.flprrc)
  3. system control file(s)
  4. data compiled into flpr

A full list of queues supported by FNPRT is available by running the command obtain printer to create the file flp.printers in your directory[37].

If your printer host is not known to flpr, you can use the option -h to specify it on the command line, set your own default printer host with the environment variable FLPHOST, or put an appropriate entry in your .flprrc user control file.

You can set environment variables such as FLPQUE and FLPHOST with the setenv command for the C shell family (see section 9.1):

% setenv FLPQUE queue
% setenv FLPHOST host

and for the Bourne shell family:

$ FLPQUE=queue; export FLPQUE
$ FLPHOST=host; export FLPHOST

A useful feature of flpr is the capacity to use nicknames. A nickname specifies the printer host computer and the queue as a pair. If you often use a printer unknown to FNPRT, this feature may be handy for you. You would then enter a print command in this format:

% flpr -P nickname file

The flp.printers file mentioned above defines many nicknames, most or all of which are associated with the host FNPRT, and is therefore more useful as a queue reference for the -q option. An example nickname is wh10w_lw, which is defined as:

printer wh10w_lw fnprt.fnal.gov wh10w_lw

Why are printer nicknames useful? If you're using a printer not recognized by the flpr defaults, you'll need to specify both host and queue unless you use a nickname. Also, we recommend that you use nicknames rather than queue names in shell scripts. If a printer fails or is removed, then its associated nickname can be redefined, and the scripts don't need to be changed. If a queue name is specified in a shell script, then this capacity does not exist. You can define a nickname yourself, or if a widely-used printer is down, it may be appropriate for your system administrator to establish a substitute printer by changing the nickname in flp.printers.

A printer nickname does not have to be the same as the printer queue name. It may be a short, easily remembered name, such as ps for a postscript printer or lp for a text printer. Such personal printer nicknames can be established in your personal flpr control file, $HOME/.flprrc.

As an example .flprrc, assume you use the FNPRT queues b0trwqms_hp for text printing, and b0trwqms_ps for Adobe PostPscript printing. You want to use the nicknames lp for text printing and ps for PostScript. Further, you would like the print jobname to contain identifiers for your login name and the file being printed. You could build a .flprrc as follows[38]:

host fnprt.fnal.gov

queue b0trwqms_ps

identifier %l$%b

printer ps fnprt.fnal.gov b0trwqms_ps

printer lp fnprt.fnal.gov b0trwqms_hp

If this file exists, it will be used automatically. flpr also accesses any system-wide defaults files, such as flp.defaults and flp.printers stored in a system directory. The flp.defaults file contains default values for the host, username, printer queue, protocol temporary filename format and one or more associations between a nickname and a host and printer queue pair.

Another option for the flpr command that may occasionally be useful is -l login-name. This specifies the remote login name to be used in case you want another user name associated with the print job. The default name is the same as that on the current system.

From the UNIX Resources page on the Web, see Printing from UNIX at Fermilab under Our Local Environment for information on the Fermilab print server, and how to list and check print queues.


[37] This file actually specifies printer-queue combinations. These names are the same as the queues when FNPRT is the host, the case for most if not all of the entries.
[38] The identifier in the file is equivalent to the -I option described in the flpr man page.

UNIX at Fermilab - 10 Apr 1998

[Next] [Previous] [Up] [Top] [Contents] [Index]