4.6. Selecting the Print Queue

In the previous section we used the default print queue. How does LPRng determine what print queue to use? First, you can explicitly specify the printer using the lpq -Pprintqueue option and the lpq -a or lpq -Pall to select all print queues:

    h4: {111} % lpq -Plp
    Printer: lp@h4
     Queue: no printable jobs in queue
    h4: {112} % lpq -Plp2
    Printer: lp2@h4
     Queue: no printable jobs in queue
    h4: {113} % lpq -a
    Printer: lp@h4
     Queue: no printable jobs in queue
    Printer: lp2@h4
     Queue: no printable jobs in queue


You can combine the lpq -a with the lpq -s option for a summary listing:

    h4: {114} % lpq -a
    Printer: lp@h4
     Queue: no printable jobs in queue
    Printer: lp2@h4
     Queue: no printable jobs in queue
    h4: {115} % lpq -s -a
    lp@h4  0 jobs
    lp2@h4  0 jobs


There is another way to explicitly specify the printqueues listed by lpq -a; see the all Printcap Entry for details.

Users can set their default printer by using the PRINTER (highest priority), LPDEST (next), NPRINTER (next), and NGPRINTER (lowest priority), environment variables. For example:

    h4: {116} % setenv PRINTER lp2
    h4: {117} % lpq
    Printer: lp2@h4
     Queue: no printable jobs in queue
    h4: {118} % unsetenv PRINTER
    h4: {119} % lpq
    Printer: lp@h4
     Queue: no printable jobs in queue


If the printer is not specified on the command line or by the environment variables, then the first printer in the printcap database will be used and then the default printer in the configuration database, and finally the compile time default. Printer and Server Information for details.