LinuxCommandLibrary

lpoptions

Manage printer options

TLDR

Set the default printer

$ lpoptions -d [printer[/instance]]
copy

List printer-specific options of a specific printer
$ lpoptions -d [printer] -l
copy

Set a new option on a specific printer
$ lpoptions -d [printer] -o [option]
copy

Remove the options of a specific printer
$ lpoptions -d [printer] -x
copy

SYNOPSIS

lpoptions [ -E ] [ -h server ] [ -p printer ] [ -l ] [ -d destination ] [ -o option[=value] ] [ -x option ]

PARAMETERS

-E
    Forces encrypted connection when connecting to the server.

-h server
    Specifies the CUPS server to use. Uses the standard CUPS port (631) unless another port number is specified.

-p printer
    Specifies the printer to configure. If not specified, the default printer is used, or all printers are configured when used with `-l` option.

-l
    Lists all available options for the printer. Useful for discovering configurable settings.

-d destination
    Sets the default printer or class. This sets the 'printer-is-shared' attribute to true on the chosen printer.
This option has been deprecated and is no longer supported.

-o option[=value]
    Sets the specified option to the given value. If no value is provided, the option is enabled.

-x option
    Removes the specified option from the printer's configuration. You must specify the printer or the command will fail.

DESCRIPTION

The `lpoptions` command in CUPS (Common UNIX Printing System) allows users to view, set, or remove printer options. It is a crucial tool for configuring printer behavior, influencing parameters such as paper size, resolution, print quality, and duplex settings. `lpoptions` can modify the default options for specific printers, user-defined options, or system-wide printer settings. It reads and writes options to a CUPS configuration file, typically `$HOME/.lpoptions` for user-specific settings and `/etc/cups/lpoptions` for system-wide settings. Options specified on the command line override defaults. The command is highly flexible, enabling granular control over the printing process. It simplifies printer configuration by providing a single command-line interface to manage a wide array of printer settings. Changes affect future print jobs submitted with `lp` or other CUPS-based printing tools.
Note: Use printer names returned by `lpstat -p`.

CAVEATS

The `-d` option to set a default printer has been deprecated.
Ensure that specified printers exist within the CUPS system. Use `lpstat -p` to list valid printer names. Incorrectly configured options can lead to printing problems or errors.

OPTION EXAMPLES

Examples of using `lpoptions -o` to modify specific printer options:
`lpoptions -p MyPrinter -o media=A4` (sets the paper size to A4).
`lpoptions -p MyPrinter -o sides=two-sided-long-edge` (enables duplex printing on the long edge).
`lpoptions -p MyPrinter -o resolution=600dpi` (sets the printing resolution to 600 DPI).
`lpoptions -p MyPrinter -o ColorModel=Gray` (sets the colour to greyscale).

OPTION FILE LOCATIONS

Printer options are typically stored in two locations:
User-specific options: `$HOME/.lpoptions`
System-wide options: `/etc/cups/lpoptions`

HISTORY

`lpoptions` is a component of CUPS, which was originally developed by Easy Software Products (ESP). CUPS was adopted by Apple Inc. and continues to be developed. It represents a significant shift away from older printing systems like LPR/LPD, providing a more modern and robust solution for managing printers in Linux and macOS environments. `lpoptions` serves as a key command-line utility for configuring printer options within the CUPS framework and offers flexibility for users and administrators to manage print settings.

SEE ALSO

lp(1), lpstat(1), cupsd(8)

Copied to clipboard