Printing Tips for the Solaris Operating System
Printing Tips for the Solaris Operating System
By Carl Grammer
Although it is generally taken for granted, printing can give you problems if you are new to UNIX or lack the information needed to get your document to your printer of choice. The following is intended to be a brief primer on printing from the Solaris environment, so you will have the information you need. Once you are up to speed, you can go right back to taking printing for granted. Now, on with a little printing Q&A.
Frequently Asked Questions
First, how do you submit a job to the printer?
As most of you probably know, at the UNIX prompt you simply type:
lp <file_name> [ <file_name2> <file_name3> ...]
Here's an example:
$ lp create2.ksh
request id is 250_mailroom-469 (1 file(s))
Where will it print?
To the default printer.
Which printer is the default printer?
Ah, there's the rub. For any user on a particular system you may have two or three default printers.
Two or three default printers?! How can you call them default?
Well, you have the system or global default, and each user can set his or her own individual default printer.
That makes two printers; what is the third?
I'll get to that later.
I still don't know where my file printed!
If you have not set your individual default, the print job will go to the system default.
OK, this is getting a bit tiresome. How do you determine what the system default is?
To determine the system's default printer, execute the following at the UNIX prompt:
lpstat -d
This will return the system or global default printer name. It will look something like this:
$ lpstat -d
system default destination: 250_mailroom
If there is no system default, you'll see something like this:
$ lpstat -d
no system default destination
How do I set my own default printer?
Use one of two environment variables to tell the lp
command which printer to use. The environment variables are as follows:
LPDEST=<printer name>or
PRINTER=<printer name>
lp
will look first at LPDEST
. If LPDEST
is
null, lp
will then look at PRINTER
. If PRINTER
is
also null, the job will go to the system default.
How do I check the status of a print job?
Use the lpstat
command again, with no
parameters. The output will be similar to the following:
$ lpstatThis reveals that the print job has been queued up. Small jobs may be transferred from the print queue on the system to the printer buffer so quickly that they may not show up using
250_mailroom-469 grammerc 12008 Dec 07 12:34 on
250_mailroom
lpstat
.
How do I find out what printers are available?
Again, the lpstat
command:
lpstat -a
The output will look something like this:
$ lpstat -a
100_training2 accepting requests since Wed Oct 11 13:59:05 CDT 2002
250_mailroom accepting requests since Wed Oct 11 17:58:51 CDT 2002
200_frontdesk accepting requests since Wed Oct 11 17:54:08 CDT 2002
200_mailroom accepting requests since Fri Oct 6 11:28:26 CDT 2002
What if I want to print to a printer other than the default?
Use the -d
parameter on the lp
command line to indicate the desired
destination, as in the following example:
lp -d 200_frontdesk <file_name>
What about this third default you mentioned?
The Solaris OS has its roots in the old BSD UNIX. The BSD printer
command is lpr
. The Solaris OS still makes
available many of the BSD utilities, including lpr
. Previously I mentioned that the lp
command searches for the name of the user's
default printer by first looking at the environment variable LPDEST
and then looking at PRINTER
. The lpr
command makes use of these same variables but searches them in the
opposite order. Therefore, if you set these variables to different
printers, you can use lp
to print to the
printer specified by LPDEST
and use lpr
to print to the printer specified by PRINTER
.
One thing to note, however: The lpr
command doesn't give
you a "warm fuzzy" by returning the request ID, like lp
does, but it prints just the same.
文章来源于领测软件测试网 https://www.ltesting.net/