Printing AIX

  • Print Devices & Queues – General information
  • Spool Directories – location
  • chque Changes the name of a printer queue
  • chquedev – Changes the name of a printer device
  • chvirprt – Changes the virtual printer definition
  • lpstat – Monitor print spooler
  • lssrc – Display status of a spool system
  • lpq – Monitor print queue
  • enq – Control print jobs
  • lp – Start a print job
  • lpr – Start a print job
  • cancel – stop a print job
  • qpri – Set priority of a print job
  • enscript – Converts a text file to Post Script
  • pr – Control print format

Print Devices & Queues

To configure a local printer, a print and queue device need to be created.

  • A print device is needed to connect the print driver to the physical port the printer is attached to. A printer is configured by using the smit makprt command.
  • A queue (alias virtual printer) is a set of attributes that define a specific software view of a real printer. A virtual printer’s view refers only to the high-level data stream – ASCII or PostScript, that the printer understands. It does not include any information about how the printer hardware is attached or the protocol used for transferring data to or from the printer. Printer queues are configured by using the smit mkvirprt command.

DTR – flow control


  • If the printer configuration has DTR set to YES, the DTR pin on the printer must be mapped to the DCD pin on the RS/6000.
  • The print driver checks to see if DCD is high before data can be sent down to the printer port. If an attempt to print directly (ls > /dev/lp1) to a port that doesn’t have DTR mapped to DCD, the command will hang until DCD goes HIGH.
  • If DTR is mapped to DCD but the printer is turned off, DTR and DCD are low. No transmission of data is generated by the driver until DCD goes high. DCD can only go high when the printer is turned on and the printer is in an online state.
  • With the 128-port adapter, ALTPIN must be ENABLED via the /usr/lbin/tty/stty-cxma command.


  • If the printer configuration has DTR set to NO, the DCD pin on the RS/6000 is not monitored before data is sent down the printer port.
  • When creating the proper pinouts for cabling to a printer, make sure that the CTS (pin 5) signal on the printer is pinned to the RTS signal on the RS/6000.
  • The RS/6000 will not send data down the printer cable unless it believes that a device is powered on.
  • If the RTS signal is low, no data will be sent to the printer cable and the following error message is shown: ksh:/dev/lp5: 0403-005 Cannot create the specified file.
  • The printer will set CTS (pin 5) high, when it’s busy.
  • If data is sent down the printer cable and nothing is printed, make sure that the DTR signal on the RS/6000 is connected to DSR on the printer. If the printer’s DSR signal is low, then some printers may not print the data it received from the host.

When configuring devices on the 8,16, and 64-port IBM async cards, remember that the lower the port number on that device, the higher the priority of that device being serviced. Therefore, make sure the devices that use more bandwidth or CPU cycles, are configured with the lower port numbers (0,1,2 vs 14,15,16).

Further, these adapters not only prioritize service by port on the adapter, they also prioritize by adapter. This means that every port on a higher-priority adapter will have their interrupts serviced before any port on a lower-priority adapter.

top of page

Spool directories

The following directories may need to be accessed to clean up aborted jobs:

  • /var/spool/lpd/qdir : Accepts requests for print jobs
  • /var/spool/lpd/stat : Status files for a print job. The backend communicates with the qdaemon through these files.
  • /var/spool/lpd/spool : qdaemon requests are spooled here

The following directories are used to store virtual printer attributes:

  • /var/spool/lpd/pio/burst : Stores header/trailer format page
  • /var/spool/lpd/pio/predef : Default attributes
  • /var/spool/lpd/pio/custom : ASCII virtual printer attributes
  • /var/spool/lpd/pio/ddi : Digested virtual printer attributes

top of page

Remote Printing

To send print jobs to a remote print server, TCP/IP must be used. The flow of a print job is as follows…

  • Job is initiated using lpr or enq
  • The /etc/qdaemon on the local machine processes the job and passes the data to a the backend process /usr/lpd/rembak
  • rembak transmits the job to the remote printer via TCP/IP
  • On the remote server lpd, by monitoring port 515, receives and processes the job to the selected printer Multiple jobs submitted on a single command line to either a local or remote print queue is NOT supported. AIX is able to use remote queues with names longer than 7 characters in length. In order for this to work, you need to define the backend of the remote queue as follows:

backend = /usr/lpd/rembak -P <QueueName> -S <ServerName> -N

  • The -P will work with queue names longer than 7 characters.
  • The -N is needed to inhibit sending AIX-specific control information to a non-AIX remote host
  • /usr/lib/lpd/aixshort indicates the remote server is another AIX machine.
  • /usr/lib/lpd/aixlong indicates the remote server is another AIX machine. (For long-form output)
  • /usr/lib/lpd/bsdshort indicates the remote server is BSD4.3 or Linux lpq printer queue
  • /usr/lib/lpd/bsdlong indicates the remote server is BSD4.3 or Linux lpq printer queue (For long-form output)

top of page


Terminates one or more print jobs, even if the job is currently being printed.

Examples What it does
cancel 280 Cancels the print job 280
cancel laser Cancels all jobs associated with the queue laser if user is root or all jobs submitted to that queue from the user who issues the cancel command.

top of page


Changes the name of a printer queue in the /etc/qconfig file. Queue names can only be up to seven characters long.

Examples What it does
chque -q lp0 -n laser Changes the print queue name from lp0 to laser
chque -q lp0 -a discipline=sjn Jobs submitted to printer queue named lp0 will now place short jobs at the start of the queue in preference to longer running jobs. The distinction between short and long jobs is the number of blocks of text that jobs consists of. This can be determined by reviewing the Blks field of the lpstat command.

top of page


Changes the name of the printer device associated with the printer queue in the /etc/qconfig file.


  • -d refers to the current name of the print device
  • -n refers to the new name of the print device
  • -q refers to the queue name associated with the print device
Example What it does
chquedev -dlp0 -qlaser -nlaser Changes the name of print device from lp0 to laser for the queue laser

top of page


Changes the virtual definition of a particular printer stream


  • -d refers to the current name of the print device
  • -a refers to the attribute to change
  • -q refers to the queue name associated with the print device
Example What it does
chvirprt -dlp1 -qlaser -a _q=1 Changes the print quality attribute of the printer queue named laser from letter to draft mode.

top of page


Disable a printer queue

Examples What it does
disable laser Brings the print queue laser off-line immediately.
disable -c laser The -c brings print queue laser off line without waiting for current job to finish printing.

top of page


Converts the ASCII form of the /etc/qconfig file into the binary version of the /etc/qconfig.bin file used by the qdaemon.

Every time a new virtual printer is added to the system, the /etc/qconfig file will get compiled by the qdaemon which updates this data file. If the date on the qconfig file is earlier than the date on the qconfig.bin file, the qconfig file will not be digested, even if it has just been modified.

Example What it does
/usr/lpd/digest /etc/qconfig /etc/qconfig.bin Creates a new version of the /etc/qconfig.bin file

top of page


Administers the line printer subsystem

Examples What it does
enq sam* Prints all the files starting with “sam” to the system printer
enq -x 150 Print job 150 is terminated immediately
enq -X laser All jobs on print queue laser will be terminated if you are the root user, else cancels all jobs submitted by that user
enq -Plaser:lp0 sales.doc Send the file sales.doc to the queue laser attached to the print device lp0 for printing
enq -D -Plaser Disables the queue laser after the current job has finished. qdaemon doesn’t send jobs to downed queues. Only applies to local queues.
enq -G qdaemon process is gracefully shutdown after all current running jobs
have finished. This is the only clean way to bring the qdaemon process down. The kill command may cause problems, such as jobs hanging in the queue. If the qdaemon process is running under srcmstr, enq -G does not prevent qdaemon from being restarted automatically. You must use the chssys command (chssys -s qdaemon -O) to prevent the automatic restart of the qdaemon process. Only applies to local queues.
enq -K -Plaser Disables the queue laser and immediately terminates any job that is currently being printed. Print jobs remain in the queue and are rerun once the queue is re-enabled. Jobs currently being run are lost. Only applies to local queues.
enq -U -Plaser Enables the queue laser. Only applies to local queues.

top of page


Enable a printer queue

Example: enable laser

top Of page


Takes a text file as input, converts it to PostScript format, and spools the file to a PostScript printer.

The ENSCRIPT environment variable can be used to specify PostScript defaults.
For example, ENSCRIPT=’-fTimes-Roman8′ sets the default body type size and font to 8 point Times Roman.

Examples What it does
enscript -dps feb3.notes Prints the file feb3.notes to printer queue ps. The enscript command will translate all the ASCII text to PostScript and pass it off to the ps queue.
enscript -r feb3.notes Prints the feb3.notes file to the default printer

top of page


Sends requests to a printer. A queue’s state only goes to running if the queue device is actually a device file and can be opened for STDOUT. Only one job at a time can be submitted to a print queue.

Options What it does
-w Writes a message on the requester’s terminal once the job has printed
-m Sends mail to the user who submitted the job once the job has printed
-d Name of the destination queue follows
Examples What it does
lp -w /etc/motd Prints the file /etc/motd to the default printer.
lp -mdlaser /etc/motd Sends the file /etc/motd to the laser queue for printing

top of page


Examines the spooling area used by ‘lpd’ for printing files. Files are spooled to the /usr/spool/qdaemon directory until they have been successfully printed or canceled.

Example: lpq

top of page


Uses the spooling daemon (lpr) to queue and print files when those facilities become available.

lpr sends files to the system default printer or to the printer specified by the environment variable LPDEST. If the LPDEST variable has no value, the PRINTER variable is used. If this environmental variable is not set, then the system default printer is used.

If you are forced to kill the /usr/lpd/lpd daemon, remove the /etc/locks/lpd file before you start up the lpd process again. If you don’t, the error messages “lpd: errno = 17: Do not specify an existing file. lpd: (FATAL ERROR): 0781-196 lock file or duplicate daemon.” is generated:

The lpd daemon will not restart, until this lock file is removed. If the message pr:Server error: your host does not have line printer access or something similar to it is displayed after an lpr print request, then edit the /etc/hosts.lpd file and add the client node your making the print request from. You don’t have to restart the lpd daemon to reread this file.

Use the lpq command to inspect the status of a job.

Use the cancel command to delete a job.

Example What it does
lpr -s /oracle/marketdata.1992 The -s option is used to link a file to the spooling directory, Rather than copying it, so that large files can be printed.

top of page


Displays printer queue status information. First printer listed by lpstat is your default queue. In other words, if no queue name is given when the LP command is executed, then the print job will be submitted to the default printer.

If the lpstat command hangs at a client machine, theres a good chance that the lpd daemon is not running on your print server.

  • Execute the startsrc -s qdaemon command to start the lpd daemon.
  • If this daemon fails to start, the lock file /etc/locks/lpd may be preventing this process from successfully starting. Delete this file and rerun startsrc -s qdaemon again.
Example What it does
lpstat Displays print queue status
lpstat -t Displays Print queue status with more detail
lpstat -plaser Displays print queue status for the queue laser only

top of page


Generates the line printer ripple test pattern

Example What it does
lptest 80 100 | pr -n Prints 100 lines of 80 column test pattern to the default print queue
– where each line is prefixed with a line number

top of page


Lists the name of the printer queue attributes stored in the /etc/qconfig file

Example What it does
lsquedev -q ibm -d dlp0 List the attributes for the queue ibm associated with the device lp0

top of page


Displays the attributes for a virtual printer or printer queue

Examples What it does
lsvirprt -qlaser -dlp0 Lists printer queue attributes and their values. The ‘q’ (queue) and ‘d’ (device) flags are required.
lsvirprt -qlaser -dlp0 -a _K Lists the condensed print attribute (_K) for the printer queue laser

top of page


List the status of a subsystem

Examples What it does
lssrc -g spooler Display status of all the spooling daemons
lssrc -a List status of all subsystems

top of page

Create another print queue to the same output device (multiple queues to one print device)

When you submit jobs to these queues remember the qdaemon redirects stdin,stdout, and stderr to the NULL device (/dev/null). If you wish to see any output from your job, you will need to redirect stdout and stderr of that job to a specific file or CRT.

Example What it does
mkquedev -d ksh1 -q bsh -a backend=/bin/ksh Creates an additional printer queue to the ‘bshdev’ device named ‘ksh1’.

top of page


Paginate a file before printing it via the lp command. Separates files into pages with headers, footer margins and page numbers. It can also produce multicolumn output. Output of this command will default to the screen but is normally redirected to a file or line printer.

Example What it does
pr -l64 UserGuide.doc | lp Paginates the UserGuide.doc to 64 lines per page and pipes the output to the system default printer.

top of page


Set the priority of a print job. This command will only work with local print queues. If the job is ranked first in the queue, this command will only work once. If the first ranked job is changed a second time, the priority won’t change. Default priority is 15. Use the lpstat -t command to see print queue priority.

Examples What it does
qpri -#169 -a 4 Lowers the priority of print job 169 to 4 from 15. If there are jobs with higher priority in the same print queue where job 169 resides, they will move ahead.
qpri -#169 -a 20 Raises the priority of print job 169 from 15 to 20. If there are jobs with higher priority in the same print queue where job 169 resides, they will move behind job 169.

top of page

startsrc -s qdaemon

This command is used to start the spool daemon named qdaemon. By default, this daemon is started everytime the system reboots.

top of page

stopsrc -s qdaemon

This command Will stop the spool qdaemon. If the qdaemon is not running, all jobs submitted to the spooler will be queued.  The job number for these print jobs will be marked ‘new’. Once the qdaemon is restarted those queued jobs will be given a job number.

top of page

Lock Files

Occasion you may get a message lpd: lock file or duplicate daemon.This can be caused if there is a problem with the lpd daemon.

When this happens

  • Remove the file /etc/locks/lpd. This file should contain the Process ID (PID) for the currently running lpd daemon.
  • Stop and start the print spooler.

top of page