The typical command syntax for setting up printers is as follows:
$ lpadmin [ -h server[:port]] -p destination option(s)
For –p destination, specify the name of either a local or a network printer.
The following are some of the options you can set:
–m model specifies the printer model such as LaserJet.
–u allow:option determines access to the printer. For option, you can specify a user or a group. To grant general access, specify all.
–v sets the device URI attribute of the printer queue. If the device URI is a filename, the file is automatically converted to the form file:///file/name. Through this option, you can set up network printers including those that are in a different subnet.
To obtain a list of supported device URIs and schemes, use the lpinfo –v command.
–D description provides a textual description inside quotes of the printer.
–L location specifies the location of the printer.
–E enables the destination printer to accept print jobs.
–P ppd-file specifies a PPD file to be used with the printer. The following are the standard locations of PPD files:
/usr/share/cups/model/foomatic-db-ppds/manufacturer-name
/usr/share/cups/model/hplip
This example sets up LaserJet, a network printer remotely located in Conference Room 1:
$ lpadmin -p LaserJet -E -v socket://203.0.113.1 -L "Conference Room 1"
This example creates an IPP print queue that uses the everywhere driver, which is the driver for most modern network printers:
$ lpadmin -p myprinter -E -v ipp://myprinter.local/ipp/print -m everywhere
This example sets up a printer that uses a PPD file:
$ lpadmin -p LaserJet -E -P /usr/share/cups/model/hplip/hp-laserjet_p4010_series-ps.ppd.gz
Instead of using the –E option to enable a printer, you can type the following alternative commands for the same purpose:
$ cupsaccept printer-name $ cupsenable printer-name