Table of Contents
Previous Chapter
The setenv command in your.cshrc file is preceded by this explanatory comment:
# Set the value of the PRINTER environmental variable to the name
# of your default printer. For printer names, see the file
# /etc/qconfig on AIX systems or /etc/printcap on other systems).
# The default value, "InvalidPrinter", prevents the lp command from
# accidently submitting print jobs to the batch queue.
The next section discusses the contents of /etc/qconfig and /etc/printcap.
If you try to print a file to InvalidPrinter, the response will depend on the system on which you issued the command (e.g., RS600, Sun) and the print command you used (e.g., lpr, enscript). For example:
Sun responses:
ilse@scssun1 $ lpr my-aid-file
lpr: InvalidPrinter: unknown printer
ilse@scssun1 $ enscript my-aid-file
enscript: 4 lines were wrapped because of length.
[ 2 pages * 1 copy ] spooled to InvalidPrinter
lpr: InvalidPrinter: unknown printer
RS6000 responses:
ilse@sisyphus $ lpr my-aid-file
enq: (FATAL ERROR): 0781-050 Bad PRINTER or LPDEST env. variable InvalidPrinter.
ilse@sisyphus $ enscript my-aid-file
enscript: 4 lines were wrapped because of length.
[ 2 pages * 1 copy ] spooled to InvalidPrinter
enq: (FATAL ERROR): 0781-048 Bad queue or device name: InvalidPrinter.
This command changes the default printer until you end that shell window. In any other shell window (including new ones) the default printer will be in effect.
more /etc/qconfig
will list one screenful of information of the file at a time. (Press the space bar to get the next screenful.) Note that both files are quite long.
The following is a sample description from the file /etc/qconfig for an Apple LaserWriter printer named lwcgb3a.:
* Computer Center Comp Group lounge
lwcgb3a:
host = lpd01
s_statfilter = /usr/lpd/bsdshort
l_statfilter = /usr/lpd/bsdlong
rq = lwcgb3a
device = rlp86
rlp86:
backend = /usr/lpd/rembak
lwcgb3a-ps:
host = lpd01
s_statfilter = /usr/lpd/bsdshort
l_statfilter = /usr/lpd/bsdlong
rq = lwcgb3a
device = rlp87
rlp87:
backend = /usr/lpd/rembak
lwcgb3a-tx:
host = lpd01
s_statfilter = /usr/lpd/bsdshort
l_statfilter = /usr/lpd/bsdlong
rq = lwcgb3a
device = rlp88
rlp88:
backend = /usr/lpd/rembak
The most useful information for most new users is:
The same printer is described in /etc/printcap as follows:
lwcgb3a|lwcgb3a.ps|lwcgb3a.tx|wingz2|lwcgb3a|Computer Center Comp Group lounge:\
:sb:\
:sh:\
:mx#0:\
:lp=:\
:rm=lpd01:\
:rp=lwcgb3a:\
:sd=/usr/spool/lp/lwcgb3a:
Aliases for the printer name lwcgb3a are given in the first line after the first "|" character. The :ty field indicates the printer model.
The commands man qconfig and man printcap will describe the printer description fields in more detail.
Two other commands you will likely find useful are:
------------------------------------------------------------------------------------------------------------------
Print command Description
------------------------------------------------------------------------------------------------------------------
lpr Use it for printing text files. It also prints TeX, troff, ditroff, PostScript files and standard
plot data to the specified or default printer.
enscript Turns a text file into a PostScript file. Particularly useful features include: multi-column,
default and tailored header line on each page, portrait and landscape modes, printer-
dependent options such as duplex, paper tray. See examples in section "Specifying How
the File Should Print" on page 47.
pslpr Prints PostScript files with similar options as enscript. See examples in section "Specify
ing How the File Should Print" on page 47.
qmslpr Prints files on QMS printers only. Similar to lpr, but has options for duplex, portrait/land
scape mode, multiple copies (collated and uncollated), input and output bin specifications,
and others.
lpq Displays the print queue for the backlog of jobs waiting to be printed.
lprm Removes or cancels the job queued in the local print queue of the computer on which you
executed the command. It does not cancel the job after it has been removed from the local
print queue by a printer server (which is another computer). For examples see section
"Locating and Canceling Print Jobs in the Print Queue" on page 49.
------------------------------------------------------------------------------------------------------------------
Examples of -Pname, the name of the printer on which you want to print, and other useful print options are given in the next section.
Jobs will be printed on the default printer, unless you specify otherwise in the argument.
If you have a new UNIX account, be sure to change the default printer from InvalidPrinter to the name of the printer that you wish to use in your.cshrc file (see section "Changing the Default Printer on New UNIX Accounts" on page 43).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ilse@sisyphus $ echo $PRINTER displays default printer name; in this case, hpcgb3b
hpcgb3b
$ lpr chap2.ps prints file chap2.ps on the default printer
$ lpq queries the print queue for the default printer; job number is 30
Queue Dev Status Job Files User PP % Blks Cp Rnk
hpcgb3b rlp22 READY
hpcgb3b hpcgb3b is ready and printing
hpcgb3b hpcgb3b RUNNING 30 chap2.ps ilse 0 0 217 1 0
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
To: Give command: Comment
--------------------------------------------------------------------------------------------------------------------------
Print header (filename, current enscript -Phpcgb3b mydoc mydoc is filename of a text
date, & page number) on each file; hpcgb3b is printer
page of text file name. Omit -Pprinter-name
if you want to use the de
fault printer.
Print 2-up landscape enscript -2r -Phpcgb3b mydoc mydoc is filename of a text
file; hpcgb3b is printer
name. Omit -Pprinter-
name if you want to use de
fault printer.
Print 2 copies of a file enscript -#2 -Phpcgb3b mydoc mydoc is filename of a text
file; hpcgb3b is printer
name; #2 specifies 2 copies.
Omit -Pprinter-name if you
want to use default printer.
Turn duplex off pslpr -Phpcgb3b -SDuplex=Off mydoc mydoc is the filename of a
PostScript file. Duplex=On
is the default for printer
hpcgb3b. Same options
work for enscript.
Print from the lower paper tray enscript -Phpcgb3b -SInputSlot=Lower mydoc Printer hpcgb3b has two
trays; the upper tray is used
by default. Same options
work for pslpr.
Turn duplex off and print from the enscript -Phpcgb3b -SInputSlot=Lower Combination of the options
lower tray -SDuplex=Off mydoc of two examples above.
Same options work for psl
pr.
Print duplexed pages so that they pslpr -Phpcgb3b -SDuplex=DuplexNoTumble -SDuplex=DuplexTumble
must be turned over from the right mydoc specifies duplexed pages
side must be turned over from
the bottom of the page. my
doc must be a PostScript
file. Same options work for
enscript.
Print several page ranges in a Post pslpr -Phpcgb3b -i3-7 -i10-15 mydoc.ps Prints pages 3 through 7 and
Script file 10 through 15 of file
mydoc.ps on printer
hpcgb3b.
Print PostScript file in landscape pslpr -Phpcgb3b -L mydoc.ps Omit -Phpcgb3b to print on
mode default printer.
Print text file in two columns in enscript -2r -Phpcgb3b mydoc Omit -Phpcgb3b to print on
landscape mode default printer.
Print two collated copies of file in qmspr -ls -#2 -c -Pqmscgb3a my-aid-file Specify -llanguage for the
landscape mode on print qmscgb3a language to be used by
printer to interpret the docu
ment. -ls is landscape; #2
requests two copies; -c asks
for copies to be collated;
printer to be used is qmscg
b3a; file my-aid-file is a
text file.
--------------------------------------------------------------------------------------------------------------------------
When issued on a Sun workstation, the command lpq displays print jobs in the local print queue; when issued on an RS/6000, the command displays jobs in the local queue and the remote print server queue. Be aware that if the printer is lightly loaded, the print job will move so quickly from the local queue to the remote server queue to the printer that by the time you issue the lpq command, the job may no longer be in the queue. The -l (long) option on the lpq command will give the name of the host on which the print job originated.
----------------------------------------------------------------------------------------------------------------------------------
$ lpq query the print queue for the default printer
Queue Dev Status Job Files User PP % Blks Cp Rnk
hpcgb3b rlp22 READY
hpcgb3b hpcgb3b is ready and printing
hpcgb3b hpcgb3b RUNNING 30 chap2.ps ilse 0 0 217 1 0
----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$ lpr chap2.ps print file chap2.ps on the default printer
$ lpq query the print queue for the default printer;
the job number is 30
Queue Dev Status Job Files User
hpcgb3b rlp22 READY
hpcgb3b hpcgb3b is ready and printing
hpcgb3b hpcgb3b RUNNING 30 chap2.ps ilse
ilse@sisyphus $ lprm 30 remove job number 30
$ lpd01: dfA030sisyphus dequeued
lpd01: cfA030SISYPHUS.SLAC.Stanford.EDU dequeued
ilse@scssun1 $ pslpr ~ilse/phonebook-ps/chap2.ps print PostScript file ~ilse/phone
book-ps/chap2.ps on default printer
ilse@scssun1 $ lpq query local job queue for default printer; the
job number is 33
no entries
scssun1: sending to lpd01
Rank Owner Job Files Total Size
1st ilse 33 standard input 110921 bytes
ilse@scssun1 $ lprm ilse remove all of user ilse's jobs from job queue
dfA033scssun1 dequeued
cfA033scssun1 dequeued
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
A job that is printing cannot be cancelled with the lprm command. You may be able to stop it at the printer by taking the printer offline or pressing the reset button. You will need to check the documentation for the printer in question.
lpr -s -Pprintername filename
No temporary copy of the file will be made; therefore......
Table of Contents
Next Chapter