Sending files to a printer (lp), Displaying print status (lpstat), The lp command flags – HP NonStop G-Series User Manual

Page 99

Advertising
background image

The lpstat utility writes, to the standard output device, information about the current status of
the online accessible printer devices and the status of the spooler job requests.

If no spooler location is given, lpstat generally uses the system default destination, as specified
in the printcap database file. If no arguments are given, lpstat writes the status of all the job
requests made to lp by the user that are still in the spooler queue.

The cancel utility deletes job requests that were made by the lp utility.

Sending Files to a Printer (lp)

Use the lp command to send one or more files to the system printer. The lp command actually
places files in a print queue. Once the lp command places your files in the queue, you can continue
to do other work on your system while you wait for the files to print.

The general format of the lp command is:

lp printername filename

printername

is the name of a printer, if your system supports more than one printer and you

wish to use a printer other than the default printer. If you want to use the default printer, you may
be able to omit printername. filename can be the name of a file, the relative pathname of a
file, the full pathname of a file, or a list of filenames separated by spaces. The format you use
depends on where the file is located in relation to your current directory. You can also use
pattern-matching characters to specify files.

The following command sends file1 to the default printer:

$ lp file1

The following command sends file2 and file3 to a printer specified by the printername
argument:

$ lp printername file2 file3

You can use the lp command together with the pr command so that your file will be formatted.
The pr command is described in

“Printing Files ” (page 98)

. For example, suppose that you wish

to format a long file, named report, and then print it. To do so, enter the following command:

$ pr report | lp

This command uses | (the pipe character) to take the output from the pr command and use it as
input to the lp command. For more information on pipes, see

Chapter 3 (page 31)

.

Several lp command flags enable you to control the way in which your file prints. Following is
the general format for using a flag with this command:

lp flag filename

Table 17

explains some of the most useful lp command flags.

Table 17 The lp Command Flags

Description

Flag

Prints the number of copies specified by copies. For example, lp --n2 file1
prints two copies of file1. The default number is one copy.

ncopies

Uses the string of characters specified by string as the job name printed on the
banner page of the output. The user’s Guardian logon name is the default job

-t string

name. string can be up to 16 alphanumeric characters. For example,
lp -t "My Report" file1

produces a banner page for file1 that reads

“My Report.”

Displaying Print Status (lpstat)

If you wish to see the position of your job in the print queue or find out its job number, use the
lpstat

command. To look at the print queue, enter:

$ lpstat

Printing Files

99

Advertising
This manual is related to the following products: