[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 3

lp Command

Purpose

Sends requests to a line printer.

Syntax

lp [ -c ] [ -dQueue ] [ -m ] [ -nNumber ] [ -oOption ] [ -s ] [ -tTitle ] [ -w ] [ Files ]

Description

The lp command arranges for the files specified by the Files parameter and their associated information (called a request) to be printed by a line printer. If you do not specify a value for the Files parameter, the lp command accepts standard input. The file name - (dash) represents standard input and can be specified on the command line in addition to files. The lp command sends the requests in the order specified. If the job is submitted to a local print queue, the lp command displays the following to standard output:

Job number is: nnn

where nnn is the assigned job number. To suppress the job number use the -s flag.

Flags

-c Copies the files to be printed immediately when the lp command is run. The lp command copies files only when requested. No links are created. If you specify the -c flag, be careful not to remove any of the files before they are printed. If you do not specify the -c flag, changes made to the files after the request is made appear in the printed output.
-dQueue Specifies the print queue to which a job is sent.
-m Sends mail (see the mail command ) after the files are printed. By default, no mail is sent upon normal completion of the print request.
-nNumber Prints the number of copies of printed output. The default number of copies is 1.
-oOption Specifies that flags specific to the backend be passed to the backend. Thus, for each queue, other flags not described in this article can be included with the lp command. See the piobe command for a list of these flags. Specifying this flag is the same as specifying the -o flag for the enq command.
-s Suppresses the automatic return of job numbers. The lp command reports the job number as the default, the -s flag overrides the default.
-tTitle Specifies printing the title of the file on the banner page of the output.
-w Writes a message on the print requester's terminal after the files are printed. If the requestor is not logged in, the mail command sends the message. If the user is logged in on multiple windows or terminals, the message may not be sent to the LFT where the command was issued. The message is sent to the first terminal on which the writesrv daemon sees the user to be logged in.
Note: If the -w flag is used in conjunction with the -m flag, the print requester will only receive mail and will not get a message on the terminal.

Examples

  1. To print the /etc/motd file on printer lp0 attached to device dlp0, enter:
    lp /etc/motd
  2. To print 30 copies of the /etc/motd file using a copy of the file, and to notify the user that the job is completed using mail, enter:
    lp -c -m -n30 -dlp0:lpd0 /etc/motd
  3. To print the /etc/motd file using backend flags -f and -a, with a job title of blah, enter:
    lp -t"blah" -o -f -o -a /etc/motd
  4. To queue the MyFile file and return the job number, enter:
    lp myfile
  5. To queue the MyFile file and suppress the job number, enter:
    lp -s myfile

Exit Status

This command returns the following exit values:

0 All input files processed successfully.
>0 No output device is available, or an error occurred.

Files

/usr/sbin/qdaemon Contains the queuing daemon.
/var/spool/lpd/qdir/* Contains the queue requests.
/var/spool/lpd/stat/* Contains information on the status of the devices.
/var/spool/qdaemon/* Contains temporary copies of enqueued files.
/etc/qconfig Contains the queue configuration file.
/etc/qconfig.bin Contains digested, binary version of the /etc/qconfig file.

Related Information

The cancel command, enable command, lpr command, lpstat command, mail command.

The writesrv daemon.

The /etc/qconfig file.

Starting a Print Job in AIX Version 4.3 System User's Guide: Operating System and Devices.

Printer Overview for System Management in the AIX Version 4.3 Guide to Printers and Printing.

Printers, Print Jobs, and Queues Overview for Users in AIX Version 4.3 System User's Guide: Operating System and Devices.

Spooler Overview for System Management in AIX Version 4.3 Guide to Printers and Printing.


[ Previous | Next | Contents | Glossary | Home | Search ]