JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Administration: Common Tasks     Oracle Solaris 11 Information Library
search filter icon
search icon

Document Information

About This Book

1.  Locating Information About Oracle Solaris Commands

2.  Managing User Accounts and Groups (Overview)

3.  Managing User Accounts and Groups (Tasks)

4.  Booting and Shutting Down an Oracle Solaris System

5.  Working With Oracle Configuration Manager

6.  Managing Services (Overview)

7.  Managing Services (Tasks)

8.  Using the Fault Manager

9.  Managing System Information (Tasks)

10.  Managing System Processes (Tasks)

11.  Monitoring System Performance (Tasks)

12.  Managing Software Packages (Tasks)

13.  Managing Disk Use (Tasks)

14.  Scheduling System Tasks (Tasks)

15.  Setting Up and Administering Printers by Using CUPS (Tasks)

Introduction to CUPS

CUPS Processes

CUPS Services

Setting Up Printers and Print Queues by Using CUPS

Managing Print Requests by Using CUPS

Setting Up Your Printing Environment to Work With CUPS

How to Set Up Your Printing Environment

Setting Up Your Printing Environment for an Upgrade

Setting Up and Administering Printers by Using CUPS Command-Line Utilities (Task Map)

Setting Up and Administering Printers by Using CUPS Command-Line Utilities

CUPS Command-Line Utilities

How to Set Up a Printer by Using the lpadmin Command

Setting a Default Printer

How to Set a Default Printer at the Command Line

How to Print to a Specified Printer

How to Verify the Status of Printers

How to Print a File to the Default Printer

How to Delete a Printer and Remove Printer Access

Setting Up and Administering Printers by Using the CUPS Web Browser Interface (Task Map)

Setting Up and Administering Printers by Using the CUPS Web Browser Interface

Requirements for Using the CUPS Web Browser Interface

Troubleshooting Issues With Accessing the CUPS Web Browser Interface

Print Administration Tasks

About the Administration Tab

About the Printers Tab

How to Add a New Printer

About the CUPS Print Manager GUI

Starting CUPS Print Manager

Setting Up Printers by Using CUPS Print Manager (Task Map)

Setting Up Printers by Using CUPS Print Manager

Local Server Configuration

Remote Server Configuration

How to Configure CUPS to Administer Remote Print Queues

Selecting a Print Device

How to Set Up a New Local Printer

Administering Printers by Using CUPS Print Manager (Task Map)

Administering Printers by Using CUPS Print Manager

Configurable Printer Properties

How to Modify the Properties of a Configured Printer

How to Rename a Printer

How to Copy a Printer Configuration

How to Delete a Printer

How to Unshare or Share a Printer

How to Disable or Enable a Printer

How to Manage Print Jobs for a Specified Printer

16.  Managing the System Console, Terminal Devices, and Power Services (Tasks)

17.  Managing System Crash Information (Tasks)

18.  Managing Core Files (Tasks)

19.  Troubleshooting System and Software Problems (Tasks)

20.  Troubleshooting Miscellaneous System and Software Problems (Tasks)

Index

Setting Up and Administering Printers by Using CUPS Command-Line Utilities

This section provides a brief description of the CUPS commands and describes how to set up and administer your printers.

CUPS Command-Line Utilities

CUPS provides various commands to set up printers and make those printers accessible to systems on the network. In addition, CUPS supports several printer-specific options that enable you to control printer configuration. The following table lists frequently used CUPS commands.


Note - Some CUPS command names are the same as legacy LP print commands, but the behavior of commands under CUPS management might be different.


Table 15-1 CUPS Command-Line Utilities

Command
Task
cancel(1)
Cancels a print request
cuspaccept(8)
Enables queueing of print requests to the named destinations
cuspdisable(8)
Disables the named printers or classes
cupsenable(8)
Enables the named printers or classes
cupsreject(8)
Rejects queueing of print requests to the named destinations
lp(1)
Submits a print request
lpadmin(8)
Sets up or changes a printer or class configuration
lpc(8)
Provides limited control over CUPS print and class queues
lpinfo(8)
Shows available devices or drivers known to the CUPS server
lpmove(8)
Moves a specified job or all jobs to a new destination
lpoptions(1)
Displays or sets printer options and defaults
lpq(1)
Shows the current print queue status
lpr(1)
Submits a print request
lprm(1)
Cancels print jobs that have been queued for printing
lpstat(1)
Displays the status information for queues and requests

How to Set Up a Printer by Using the lpadmin Command

  1. Connect the printer to the system, then turn on the power to the printer.

    Consult the printer vendor's installation documentation for information about hardware switches and cabling requirements.

  2. Become an administrator.

    For more information, see How to Obtain Administrative Rights in Oracle Solaris Administration: Security Services

  3. Use the lpadmin command with the -p option to add a printer to CUPS.

    Only the most commonly used options of the CUPS lpadmin command are shown here. For information about other options, see the lpadmin(8) man page.

    $ /usr/sbin/lpadmin -p printer-name -E -v device -m ppd
    -p

    Specifies the name of the printer to add.

    -E

    Enables the destination and accepts jobs.

    -v

    Sets the device-uri attribute of the print queue.

    -m

    Sets the PPD file for the printer from the model directory or by using one of the driver interfaces.

    See the examples at the end of this procedure.

  4. Enable the printer to accept print requests and to print those requests.
    $ cupsaccept printer-name
    $ cupsenable printer-name
  5. Verify that the printer is correctly configured.
    $ lpstat -p printer-name -l

Example 15-1 Adding a Printer That Is Connected to the Parallel Port

To add an HP DeskJet printer DeskJet that is connected to the parallel port, you would type the following command:

$ /usr/sbin/lpadmin -p DeskJet -E -v parallel:/dev/lp1 -m deskjet.ppd
deskjet.ppd

PPD file for the HP DeskJet drivers included with CUPS

Example 15-2 Adding a Printer That Uses a PPD File

To add an HP LaserJet printer LaserJet by using a JetDirect network interface with the IP address 10.1.1.1, you would type the following command:

$ /usr/sbin/lpadmin -p LaserJet -E -v socket://10.1.1.1 -m laserjet.ppd
laserjet.ppd

PPD file for the HP LaserJet drivers included with CUPS

Example 15-3 Adding a Printer That Is Connected to the Serial Port

To add a dot matrix printer that is connected to the serial port, you would type the following command:

$/usr/sbin/lpadmin -p DotMatrix -E -m epson9.ppd \ -v serial:/dev/ttyS0?baud=9600+size=8+parity=none+flow=soft

Specify the serial port, baud rate, number of bits, parity, and flow control. If you do not need flow control, delete the +flow=soft attribute.

Setting a Default Printer

You can specify the default printer in one of the following ways:

The print command searches for the default printer in the following order:

  1. The printer name as set by the lp command with the -d option

  2. The value of the LPDEST environment variable

  3. The value of the PRINTER environment variable

For instructions on setting up printers by using the CUPS web browser interface, see Setting Up and Administering Printers by Using the CUPS Web Browser Interface .

How to Set a Default Printer at the Command Line

The default printer can be a local printer or a remote printer.

  1. Become an administrator on the system where you want to set a default printer.
  2. Set the system's default printer by using one of the following methods:
    • By specifying the PRINTER variable:
      $ export PRINTER=printer-name

      where printer-name specifies the name of the printer to be assigned as the system's default printer. If you do not specify printer-name, the system is set up with no default printer.


      Note - When using the lp command with the -d option, the destination printer, which might not be the default printer, is specified. If the -d option is not specified, the print command searches for information about the printer in the PRINTER environment variable.


    • By specifying the LPDEST variable:
      $ export LPDEST=printer-name

      where printer-name specifies the name of the printer to be assigned as the system's default printer. If you do not specify printer-name, the system is set up with no default printer.


      Note - If both the LPDEST and the PRINTER environment variables are set, LPDEST takes precedence.


    • By using the lpoptions command:
      $ lpoptions -d printer-name
      -d

      Specifies the destination printer.

      printer-name

      Specifies the name of the printer that is assigned as the system's default printer. If you do not specify printer-name, the system is set up with no default printer.

      For more information, see the lpoptions(1) man page.

  3. Verify the system's default printer.
    $ lpstat -d
  4. To print to the default printer, type the following command:
    $ lp filename

Example 15-4 Setting a Default Printer by Specifying the PRINTER Variable

The following example shows how to set the printer luna as the system's default printer by using the PRINTER variable.

$ export PRINTER=luna
$ lpstat -d
system default destination: luna

Example 15-5 Setting a Default Printer by Specifying the LPDEST Variable

The following example shows how to set the printer luna as the system's default printer by specifying the LPDEST variable.

$ export LPDEST=luna
$ lpstat -d
system default destination: luna

Example 15-6 Setting a Default Printer by Using the lpoptions Command

The following example shows how to set the printer luna as the system's default printer. The printer luna is used as the system's default printer if the LPDEST or the PRINTER environment variable is not set.

$ lpoptions -d luna
$ lpstat -d
system default destination: luna

The lpoptions command creates a ~/.lpoptions file that includes and entry for the default printer luna in the file. By default, all print jobs are now directed to the luna printer.

How to Print to a Specified Printer

  1. (Optional) Verify the status of the printer.
    $ lpstat -p printer-name
  2. Provide the destination printer name when issuing the lp command.
    $ lp -d destination-printer filename
    -d

    Specifies the destination printer.

    destination-printer

    Specifies the name of the printer that you are assigning as the destination printer.

    filename

    Specifies the file name to print.


    Note - You can also use the lpr command with the -p option to submit a print request to a specific printer. For more information, see the lpr(1) man page.


Example 15-7 Printing to a Specified Printer by Using the lp Command

The following example shows how to set the printer luna as the destination printer.

$ lp -d luna abc.ps
request id is luna-1 (1 file(s))

$ lpstat -d
system default destination: saturn

The -d option of the lp command takes precedence over the LPDEST and PRINTER environment variables.

Note that in this example, the default printer is saturn.

How to Verify the Status of Printers

The lpstat command displays information about accessible printers and jobs.

  1. Log in to any system on the network.
  2. (Optional) Verify the status of all printers or a specific printer.

    Only the most commonly used options are shown here. For information about other options, see the lpstat(1) man page.

    $ lpstat [-d] [-p] printer-name [-l] [-t]
    -d

    Shows the system's default printer.

    -p printer-name

    Shows that a printer is active or idle, and when the printer was enabled or disabled.

    You can specify multiple printer names with this command. Use a space or a comma to separate printer names. If you use spaces, enclose the list of printer names in quotation marks. If you do not specify printer-name, the status of all printers is displayed.

    -l

    Shows the characteristics of printers and jobs.

    -t

    Shows status information about CUPS, including the status of all printers, for example whether printers are active and accepting print requests.

Example 15-8 Displaying the Status of Printers

To display the status of the printer luna:

$ lpstat -p luna
printer luna is idle. enabled since Jul 12 11:17 2011. available.

To display the system's default printer:

$ lpstat -d
system default destination: luna

To display the description of the printers asteroid and luna:

$ lpstat -p "asteroid, luna" -D
printer asteroid faulted. enabled since Jan 5 11:35 2011. available.
unable to print: paper misfeed jam

Description: Printer by break room
printer luna is idle. enabled since Jan 5 11:36 2011. available.
Description: Printer by server room.

To display the characteristics of the printer luna:

$ lpstat -p luna -l
printer luna is idle.  enabled since September 29, 2011 05:20:57 PM BST

How to Print a File to the Default Printer

  1. Log in to any system on the network.
  2. (Optional) Verify the status of the printer.
    $ lpstat -p printer-name
  3. Issue a print request in one of the following ways:
    • By using the lp command:
      $ lp filename
    • By using the lpr command:
      $ lpr filename

    Note - Only the basic commands are shown in this procedure. For information about the other options, see the lp(1) and the lpr(1) man pages.


How to Delete a Printer and Remove Printer Access

  1. Become an administrator on a print client with access to the printer to delete.
  2. On the system that is the print client, delete information about the printer.
    $ lpoptions -x printer-name
    printer-name

    Specifies the name of the printer to delete.

    -x

    Deletes the specified printer.


    Note - The -x option only removes the default options for a specific printer and instance. The original print queue still remains until it is deleted by using the lpadmin command.


  3. Become an administrator.
  4. On the system that is the printer server, stop accepting print requests for the printer.
    $ cupsreject printer-name

    This step prevents any new requests from entering the printer's queue while you are in the process of removing the printer.

  5. Stop the printer.
    $ cupsdisable printer-name
  6. Delete the printer.
    $ lpadmin -x printer-name
  7. Verify that the printer has been deleted, as follows:
    1. Confirm that the printer has been deleted on the print client.
      $ lpstat -p printer-name -l

      The command output displays a message indicating the printer does not exist.

    2. Confirm that the printer has been deleted on the print server.
      $ lpstat -p printer-name -l

      The command output displays a message indicating that the printer does not exist.

Example 15-9 Deleting a Printer

The following example shows how to delete the printer luna from the print client terra and from the print server jupiter.

terra# lpoptions -x luna
terra# lpstat -p luna -l
jupiter# lpadmin -x luna
jupiter# lpstat -p luna -l
lpstat: Invalid destination name in list "luna"!