How to use the command "lpinfo" (with examples)

How to use the command "lpinfo" (with examples)

The lpinfo command is a useful tool for managing printers and drivers on a CUPS print server. It allows you to list connected printers and installed drivers, as well as search for drivers based on make and model. In this article, we will explore several use cases of the lpinfo command with code examples.

Use Case 1: Listing Connected Printers

To list all the currently connected printers, you can use the following command:

lpinfo -v

Motivation:

This command is useful when you want to quickly check which printers are currently connected to the CUPS print server. It provides a list of all the printer URIs (Uniform Resource Identifiers) along with their corresponding connection type.

Explanation:

The -v option stands for “verbose” and it instructs lpinfo to provide detailed information about the printers. This includes the printer URIs, connection types, and printer names.

Example Output:

network beh
network socket
direct scsi

The example output above shows three connected printers: two network printers (one using the “beh” connection type and another using the “socket” connection type) and one directly connected printer using the “scsi” connection type.

Use Case 2: Listing Installed Printer Drivers

To list all the currently installed printer drivers, you can use the following command:

lpinfo -m

Motivation:

This command is useful when you want to check which printer drivers are already installed on the CUPS print server. It helps you identify the available options for configuring and setting up new printers.

Explanation:

The -m option stands for “model” and it instructs lpinfo to list all the installed printer drivers. Each printer driver is represented by a PPD (PostScript Printer Description) file, which contains information about the capabilities and settings of the printer.

Example Output:

Canon-LBP-2900-cupswrapper: Canon LBP2900 CAPT printer driver (rpm package)
epson-201304w: Common files for Epson Inkjet Printers
epson-escp2-201303w: Epson ESC/P2 printer driver (experimental)

The example output above shows three installed printer drivers: Canon LBP2900, Epson Inkjet Printers (common files), and Epson ESC/P2 (experimental).

Use Case 3: Searching Installed Printer Drivers by Make and Model

To search for installed printer drivers based on make and model, you can use the following command:

lpinfo --make-and-model "printer_model" -m

Motivation:

This command is useful when you want to find a specific printer driver for a particular make and model. It helps you locate the appropriate driver for configuring and setting up a specific printer.

Explanation:

The --make-and-model option is used to specify the make and model of the printer you are searching for. The argument “printer_model” should be replaced with the actual make and model of the printer. The -m option is used to list the matching printer drivers.

Example Output:

Canon-LBP-2900-cupswrapper: Canon LBP2900 CAPT printer driver (rpm package)

The example output above shows the installed printer driver for a Canon LBP2900 printer. This is the only driver that matches the specified make and model.

Conclusion

In this article, we have explored several use cases of the lpinfo command. We have seen how to list the currently connected printers, list the installed printer drivers, and search for drivers based on make and model. The lpinfo command is a valuable tool for managing printers and drivers on a CUPS print server, providing essential information for configuring and setting up printers on your system.

Related Posts

How to use the command `dhcp6d` (with examples)

How to use the command `dhcp6d` (with examples)

The dhcp6d command is a stateless DHCPv6 server that allows for the allocation of IPv6 addresses to clients on a network.

Read More
How to use the command 'ybacklight' (with examples)

How to use the command 'ybacklight' (with examples)

The ‘ybacklight’ command is used to manage screen backlight brightness. It is a command line utility that allows you to control the brightness of your screen.

Read More
How to use the command 'lsusb' (with examples)

How to use the command 'lsusb' (with examples)

The ’lsusb’ command is used to display information about the USB buses and devices connected to them on a Linux system.

Read More