Control printers from Linux command line
Thursday, October 28, 2004 03:15 PM
Everyone knows that Linux makes a great Web server. Some network administrators even use it in conjunction with Samba to create file servers that Windows workstations can access as easily as Windows NT/2000 file servers. However, if you want to use your Linux server as a print server, you can do that too. The most effective way, although not always the easiest, is using Linux print utilities.
Author's Note
This article is based on command lines available in RedHat Linux 9.0, the latest release available. Each flavor of UNIX has slightly different command lines, and some UNIX flavors are not yet using CUPS, so the commands can be very different. A good idea is to take a look at the main page for the various command lines to examine and choose the proper options. I will point out some of the differences in commands throughout the article.
Who needs a GUI?
Keep
in mind that most flavors of UNIX have a GUI printer administration
tool. Several different environments are packaged with Redhat 9.0
Linux. This article will give you the basics on how printers work, how
to configure them, and how to maintain them with command line options.
Many
people prefer GUI interfaces when working with operating systems
they're not completely familiar with because they're easier to use.
Once you have a good understanding of the system, you may find that
command line utilities give you more granular control over the printing
environment while also allowing you to make modifications more rapidly.
Rather than click, wait, click, wait, click, wait, you can just type
the commands in a terminal window, press [Enter], and be done.
CUPS
Many
flavors of Linux have adopted the new printing standard, CUPS (Common
UNIX Printer System). This is the first update to the UNIX printing
world in many years. It allows items such as:
- Native support for IPP, Internet Printing Protocol
- Native support for Windows printers
- The ability to browse network printers
- Support for PPD, PostScript Printer Definitions
Prior versions of UNIX print services were based mainly on line printers, those old huge impact printers that only printed text on green bar paper. CUPS allows a lot of functionality and gives support for many more printers. It also allows all of the graphical capabilities that were lacking.
Linux print commands
Linux has several different print commands that you can use from a terminal window. Most of the commands can be used by both the logged on user id as well as by root. Others work only from root. The following is a list of the utilities that allow you to administer and control the printing system that you can use when logged in as either user or root:
- /usr/bin/lp - Used to submit print jobs
- /usr/bin/lp.cups - Used to submit print jobs
- /usr/bin/lpoptions - Gets and sets printer options for a single user when run by a user or for the system when used by root
- /usr/bin/lppasswd - Changes printing passwords for an individual user or adds, deletes, and changes printer users and passwords when run by root
- /usr/bin/lpq - Shows the status of a printer queue
- /usr/bin/lpq.cups - Shows the status of a printer queue
- /usr/bin/lpr - Used to submit print jobs
- /usr/bin/lpr.cups - Used to submit print jobs, forcing use of CUPS
- /usr/bin/lprm - Used to remove print jobs from a queue
- /usr/bin/lprm.cups - Used to remove print jobs from a queue
- /usr/bin/lpstat - Gives status of the CUPS system, such as queue lengths and printers
- /usr/bin/lpstat.cups - Gives status of the CUPS system, such as queue lengths and printers
- /usr/bin/cancel - Cancels a print job
- /usr/bin/enable - Enables a print queue or class of printers, requires a management password
- /usr/bin/disable - Disables a print queue or class of printers, requires a management password
- /usr/sbin/lpadmin - Manages printers and classes, requires a management password
- /usr/sbin/lpc - A compatibility program for Berkley style printers, limited to queue status in CUPS
- /usr/sbin/lpc.cups - A compatibility program for Berkley style printers, limited to queue status in CUPS
- /usr/sbin/lpdomatic - A filter script provided to be used in setting up printers
- /usr/sbin/lpinfo - Shows available printer devices and drivers on the system
- /usr/sbin/lpmove - Moves the jobs destined for a queue to another queue
- /usr/bin/lprsetup.sh - A shell script provided to help set up ghostscript printers
- /usr/sbin/accept - Causes the print queue to accept requests
- /usr/sbin/reject - Causes the print queue to reject requests




There are currently no comments for this post.