You don't need a GUI to administer CUPS printing in Fedora Core. In fact, some administrators don't even put GUIs on their servers. Even though many consider graphical administration interfaces to be more intuitive, some hard-core administrators will tell you that GUIs are for wimps. This section describes tools you can use to configure, tune, and troubleshoot printers from the command line.
Note |
If you make changes to printer configuration files directly from the command line, you risk having these values overwritten the next time you use a GUI tool to edit that file. In general, you should use one interface and stick with it if possible. |
Table 14-1 shows a list of commands and configuration files that you can use to administer printing from a command-line shell.
Administrative Printing Commands |
|
---|---|
cupsconfig |
Open CUPS graphical administrative interface (equivalent to typing http://localhost:631 in a web browser window) |
cupstestppd |
Testa ppd file before you install it: cupstestppd filename.ppd |
disable |
Temporarily disable a printer. Jobs can still be queued, but will not be sent to the printer until re-enabled: disable printer1 |
/usr/bin/enable |
Re-enable a printer that is disabled (use full path, so as not to conflict with enable shell built-in): /usr/bin/enable printer1 |
lpoptions |
Change options for a selected printer and set them as system defaults. Options are stored in the /etc/cups/lpoptions file |
reject |
Reject attempt to send documents to a printer queue (use lpstat - a to check this status): reject printer1-Rejects jobs sent to printer1 |
accept |
Begin again to accept jobs to selected printer (use lpstat - a to check this status): accept printer1-Accepts jobs sent to printer1 |
cupsaddsmb |
Configure a printer client for Samba. See Chapter 15 for details about this command and general Samba printer sharing. |
lpadmin |
Configure print queues |
lpinfo |
List CUPS devices and drivers: lpinfo -v-Lists devices to which printers can be connected (serial, parallel, usb, and so on) lpinfo -m-Lists all printer drivers available |
Printer Configuration and Log Files |
|
---|---|
/var/log/cups/error_log |
See the activities of the cupsd daemon. Good place to look to see what values are being sent to the cupsd daemon if you are debugging printing problems |
/var/log/messages |
General Linux message file. Contains information about starting and stopping the CUPS service |
/var/log/cups/access_log |
Lets you view messages describing when print jobs were sent and who sent them |
Note |
In Table 14-1, I assume that you are running administrative commands as the root user. In a few cases, commands are duplicated in user and administrative sections. In these cases, running the command as root will impact the whole system (that is, it will change options for all users). These same commands run by regular users will effect only that user's printing options and jobs. |
If you plan to skip the GUI interfaces, you need to use the lpadmin command to add a printer. Here's an example:
// lpadmin -p printer1 -v parallel:/dev/lp0 -m deskjet.ppd
In this example, we added a printer named printer1 that is connected to the first parallel port on the computer ( /dev/lp0). The PPD file used for this printer is deskjet.ppd. You can find PPD files in the /usr/share/cups/model/ directory.
To delete the printer at a later time, use the -x option:
# lpadmin -x printer1 Adding a printer class with lpadmin
To keep one printer from getting too backed up, you can create printer classes. By adding several printers together in a class, print jobs can be distributed across a group of computers. Here is an example:
# lpadmin -p printer1 -c myclass # lpadmin -p printer2 -c myclass
The first command creates the printer class named myclass and adds printer1 to that class. The second command adds the printer named printer2 to that class. To see all the members of that class, issue the command
# lpstat -s system default destination: printer1 members of class myclass: printer1 printer2
Then, to send a print job so that the job goes to one of the printers in the class, you could simply use the class name instead of the printer name, as in
# lpr -P myclass file1.ps