This chapter describes the procedures for administer printers with the LP commands.
This is a list of the step-by-step instructions in this chapter.
For overview information about printing and the LP print service, see Chapter 2, Managing Printing Services (Overview).
This section provides instructions for day-to-day tasks you perform to manage printers and the print scheduler.
If a printer needs to be replaced or you want to move the printer to a different location, you must delete the printer information from the LP print service before you physically remove it from the print server. You should also make sure that all the current print requests on the printer are printed or moved to another printer to be printed.
Not only does the printer information need to be deleted from the print server, but it also needs to be deleted from the print clients or network name service. If you delete a local printer from a print server, you should delete the remote printer entry from the print clients or network name service. If you move a printer to another print server, you need to delete the old remote print entry from the print clients or network name service and add access to the remote printer in its new location.
For detailed information on how to delete a local and remote printer, see How to Delete a Printer and Remote Printer Access. You can use Solaris Print Manager to delete a local or remote printer. However, Solaris Print Manager does not enable you to move queued print requests to another printer.
Use this procedure when you a removing a printer from service and you want to remove the printer access from the print clients and remove the printer information from the print server.
Log in as superuser, lp, or assume an equivalent role on a print client that has access to the printer you want to delete.
Delete information about the printer from the print client.
print-client# lpadmin -x printer-name |
-x |
Deletes the specified printer. |
printer-name |
Name of the printer you want to delete. |
Information for the specified printer is deleted from the print client's /etc/lp/printers directory.
If the print client does not use another printer on the same print server, delete information about the print server from the print client.
print-client# lpsystem -r print-server |
-r |
Removes the specified print server. |
print-server |
Name of the print server you want to delete. |
The print server is deleted from the print client's /etc/lp/Systems file.
Repeat Step 2 through Step 3 on each print client that has access to the printer.
Log in as superuser or lp or assume an equivalent role on the print server.
Stop accepting print requests on the printer.
print-server# reject printer-name |
reject printer-name |
Rejects print requests for the specified printer. |
This step prevents any new requests from entering the printer's queue while you are in the process of removing the printer. For a detailed description, see How to Accept or Reject Print Requests for a Printer.
print-server# disable printer-name |
This step stops print requests from printing. For a detailed description on how to stop printing, seeHow to Enable or Disable a Printer.
Move any print requests that are still in the queue to another printer.
For a detailed description on how to move print requests to another printer, see How to Move Print Requests to Another Printer.
Delete the printer from the print server.
print-server# lpadmin -x printer-name |
Configuration information for the printer is deleted from the print server's /etc/lp/printers directory.
Delete information about the print clients that were using the printer you just deleted, unless they are still using another printer on the print server.
print-server# lpsystem -r print-client1[,print-client2 ...] |
-r |
Removes the specified print client. |
print-client |
Name of the print client you want to delete from the print server. You can specify multiple print clients in this command. Use a space or a comma to separate print client names. If you use spaces, enclose the list of print clients in quotes. |
The specified print clients are deleted from the print server's /etc/lp/Systems file.
Verify that the printer information has been deleted:
Confirm that the printer information has been deleted on the print client.
print-client$ lpstat -p printer-name -l |
You should receive an error indicating that the printer does not exist in the output of the above command.
Confirm that the printer information has been deleted on the print server.
print-server$ lpstat -p printer-name -l |
You should receive an error indicating that the printer does not exist in the output of the above command.
The following example shows how to delete the printer luna from the print client terra and from the print server jupiter, and also delete the print client terra from the print server.
terra# lpadmin -x luna Removed “luna”. terra# lpstat -p luna -l jupiter# lpadmin -x luna jupiter# lpsystem -r terra Removed “terra”. jupiter# lpstat -p luna -l |
Many routine printer administration tasks require information about the status of the LP print service or a specific printer. For example, you can determine which printers are available for use and examine the characteristics of those printers. You can use the lpstat command to find out status information about the LP print service or a specific printer.
Log in to any system on the network.
Check the status of printers.
Only the most commonly used options are shown here. For other options, see lpstat(1).
$ lpstat [-d] [-p printer-name [-D] [-l]] [-t] |
-d |
Shows the system's default printer. |
-p printer-name |
Shows if a printer is active or idle, when it was enabled or disabled, and whether it is accepting print requests. You can specify multiple printer names with this command. Use a space or a comma to separate printer names. If you use spaces, enclose the list of printer names in quotes. If you don't specify printer-name, the status of all printers is displayed. |
-D |
Shows the description of the specified printer-name. |
-l |
Shows the characteristics of the specified printer-name. |
-t |
Shows status information about the LP print service, including the status of all printers: whether they are active and whether they are accepting print requests. |
The following example shows how to displays the system's default printer.
$ lpstat -d system default destination: luna |
The following example shows how to display the status of the printer luna.
$ lpstat -p luna printer luna is idle. enabled since Jul 12 11:17 2001. available. |
The following example shows how to display the description of the printers asteroid and luna.
$ lpstat -p "asteroid luna" -D printer asteroid faulted. enabled since Jul 12 11:35 2001. available. unable to print: paper misfeed jam Description: Printer by break room printer luna is idle. enabled since Jul 12 11:36 2001. available. Description: Printer by server room. |
The following example shows how to display the characteristics of the printer luna.
$ lpstat -p luna -l printer luna is idle. enabled since Thu Jul 12 15:02:32 ... Form mounted: Content types: postscript Printer types: PS Description: Connection: direct Interface: /usr/lib/lp/model/standard After fault: continue Users allowed: (all) Forms allowed: (none) Banner not required Character sets: Default pitch: Default page size: 80 wide 66 long Default port settings: |
The print scheduler, lpsched, handles print requests on print servers. However, there might be times when the print scheduler stops running on a system, so print requests stop being accepted or printed.
The following section describes how to restart the print scheduler. If a print request was printing when the print scheduler stopped running, the print request will be printed in its entirety when you restart the print scheduler.
Log in as superuser, lp, or assume an equivalent role on the print server.
Check to see if the print scheduler is running.
# lpstat -r |
If the print scheduler is not running, the message scheduler is not running is displayed.
If the print scheduler is running, stop it.
# /etc/init.d/lp stop |
Log in as superuser, lp, or assume an equivalent role on the print server.
Check to see if the print scheduler is running.
# lpstat -r |
If the print scheduler is not running, the message scheduler is not running is displayed.
If the print scheduler is not running, start it.
# /etc/init.d/lp start |
This section provides step-by-step instructions on setting or resetting printer definitions. Some of the following printer definitions can be set using Solaris Print Manager. The following procedures use the LP commands to quickly set or reset printer definitions.
Log in as superuser, lp, or assume an equivalent role on the print server.
# lpadmin -p printer-name -D "comment" |
-p printer-name |
Name of the printer for which you are adding a description. |
-D "comment" |
Specifies the characteristics of the printer, such as location or administrative contact. Enclose characters that the shell might interpret (like *, ?, \, !, ^) in single quotation marks. |
For more information, see lpadmin(1M).
The printer description is added in the print server's /etc/lp/printers/printer-name/comment file.
Verify that the Description information is correct.
$ lpstat -p printer-name -l |
The following example shows how to add a printer description for the printer luna.
# lpadmin -p luna -D "Nathans office" |
You can specify a default printer destination for a user so the user doesn't need to type the printer name when using the print commands. Before you can designate a printer as the default, the printer must be known to the print service on the system. You can set a user's default printer destination by setting any of the following:
LPDEST environment variable
PRINTER environment variable
The _default variable in the user's .PRINTERS file
The system's default printer (by using the lpadmin -d command or Solaris Print Manager
When an application provides a printer destination, that destination is used by the print service, regardless of whether you have set a system's default printer destination. If an application doesn't provide a printer destination or if you don't provide a printer name when using a print command, the print command searches for the default printer in a specific order. The following table shows the search order for a system's default printer destination.
Table 5–1 Search Order for Default Printer Destinations
Search Order |
Using /usr/bin/lp Command |
Using lpd-Based Compatibility Commands (lpr, lpq, and lprm) |
---|---|---|
First |
LPDEST variable |
PRINTER variable |
Second |
PRINTER variable |
LPDEST variable |
Third |
System's default printer |
System's default printer |
Log in as superuser, lp, or assume an equivalent role on the system where you want to set a default printer.
Set the system's default printer.
# lpadmin -d [printer-name] |
-d printer-name |
Name of the printer you are assigning as the system's default printer. If you don't specify printer-name, the system is set up with no default printer. |
The default printer name is entered in the system's /etc/lp/default file.
Check the system's default printer.
$ lpstat -d |
The following example shows how to set the printer luna as the system's default printer. This means that luna is used as the system's default printer if the LPDEST or PRINTER environment variables are not set.
# lpadmin -d luna # lpstat -d system default destination: luna |
A banner page identifies who submitted the print request, the print request ID, and when the request was printed. A banner page will also have a modifiable title to help users identify their printouts.
Banner pages make identifying the owner of a print job easy, which is especially helpful when many users submit jobs to the same printer. Printing banner pages uses more paper, however, and might not be necessary if a printer has only a few users. In some cases, printing banner pages is undesirable. For example, if a printer has special paper or forms mounted, like paycheck forms, printing banner pages might cause problems.
By default, the print service forces banner pages to be printed. However, you can give users a choice to turn off printing of a banner page when they submit a print request. You can set this choice through the lpadmin command or through Solaris Print Manager. If you give the users a choice, they have to use the -o banner option to turn off banner page printing.
Also, you can turn off banner pages for a printer so they are never printed. This is important if you have a situation where you don't need or want banner pages. You can turn off banner page printing by using the lpadmin command.
Table 5–2 Banner Page Printing
Command Used |
Banner Page Printing |
Override? |
---|---|---|
lpadmin -p printer -o banner or lpadmin -p printer -o banner=always |
Required and printed |
If you are a regular user and use p -o nobanner, the request is printed, but the nobanner argument is ignored. If you are root or another privileged user, the nobanner argument is honored. |
lpadmin -p printer -o nobanner lpadmin -p printer -o banner=optional |
On by default, but can be disabled on a per request basis with the lp -o nobanner command. |
N/A |
lpadmin -p printer -o banner=never |
Disabled |
No |
For step-by-step command-line instructions, see How to Turn Off Banner Pages.
Log in as superuser, lp, or assume an equivalent role on the print server.
# lpadmin -p printer-name -o banner=optional |
-p printer-name |
Name of the printer for which you are making banner pages optional. |
Enables users to specify no banner page when they submit a print request. |
If you want to force a banner page to print with every print request, specify the -o banner=always option.
The banner page setting is entered in the print server's /etc/lp/printers/printer-name/configuration file.
Verify that the output from the following command contains the line Banner not required.
$ lpstat -p printer-name -l |
The following example shows how to make the banner page optional on the printer luna.
# lpadmin -p luna -o banner=optional |
Log in as superuser, lp, or assume an equivalent role on the print server.
Turn off banner printing.
lpadmin -p printer-name -o banner=never |
-p printer-name |
Name of the printer for which you are making banner pages optional. |
-o banner=never |
Disables banner page printing under all circumstances. |
The banner page setting is entered in the print server's /etc/lp/printers/printer-name/configuration file.
Verify that the output from the following command contains the line Banner not printed.
$ lpstat -p printer-name -l |
Submit a print request to the printer to make sure a banner page does not print.
The following example shows how to disable printing banner pages on the printer luna.
# lpadmin -p luna -o banner=never |
The print service enables you to group several locally attached printers into one class. You can perform this task only by using the lpadmin -c command.
When you have set up a printer class, users can then specify the class (rather than individual printers) as the destination for a print request. The first printer in the class that is free to print is used. The result is faster turnaround because printers are kept as busy as possible.
There are no default printer classes known to the print service. Printer classes exist only if you define them. Here are some ways you could define printer classes:
By printer type (for example, PostScript)
By location (for example, 5th floor)
By work group or department (for example, Accounting)
Alternatively, a class might contain several printers that are used in a particular order. The LP print service always checks for an available printer in the order in which printers were added to a class. Therefore, if you want a high-speed printer to be accessed first, you would add it to the class before you add a low-speed printer. As a result, the high-speed printer would handle as many print requests as possible. The low-speed printer would be reserved as a backup printer when the high-speed printer is in use.
Print requests are balanced between printers in a class only for local printers.
Class names, like printer names, must be unique and can contain a maximum of 14 alphanumeric characters and underscores.
You are not obligated to define printer classes. You should add them only if you determine that using printer classes would benefit users on the network.
Log in as superuser, lp, or assume an equivalent role on the print server.
# lpadmin -p printer-name -c printer-class |
-p printer-name |
Name of the printer you are adding to a class of printers. |
-c printer-class |
Name of a class of printers. |
The specified printer is added to the end of the list in the class in the print server's /etc/lp/classes/printer-class file. If the printer class does not exist, it is created.
Verify that the printers are in a printer class.
$ lpstat -c printer-class |
The following example shows how to add the printer luna in the printer class roughdrafts.
# lpadmin -p luna -c roughdrafts |
If you choose, the print service can notify you when it detects a printer fault. You can select any of the following methods to receive printer fault notification with the lpadmin -A command or with Solaris Print Manager:
Write a message to the terminal on which root is logged in
Electronic mail to root
No notification
However, the lpadmin -A command offers you an additional option of receiving a message specified by the program of your choice. It also enables you to selectively turn off notification for an error that you already know about.
Unless you specify a program to deliver fault notification, the content of the fault alert is a predefined message that says the printer has stopped printing and needs to be fixed.
The following table lists the alert values that you can set for a printer with the lpadmin -A command. These alert values can also be set for print wheels, font cartridges, and forms.
Table 5–3 Values for Printing Problem Alerts
Value for -A alert |
Description |
---|---|
'mail [user-name]' |
Send the alert message by email to root or lp on the print server, or the specified user-name, which is a name of a user. |
'write [user-name]' |
Send the alert message to the root or lp console window on the print server, or to the console window of the specified user-name, which is a name of a user. The specified user must be logged in to the print server to get the alert message. |
'command' |
Run the command file for each alert. The environment variables and current directory are saved and restored when the file is executed. |
quiet |
Stop alerts until the fault is fixed. Use this when you (root or specified user) receive repeated alerts. |
none |
Do not send any alerts. This is the default if you don't specify fault alerts for a printer. |
Log in as superuser, lp, or assume an equivalent role on the print server.
Set fault alerts for a printer.
# lpadmin -p printer-name -A alert [-W minutes] |
-p printer-name |
Name of the printer for which you are specifying an alert for printer faults. |
-A alert |
Specifies what kind of alert will occur when the printer faults. For detailed information about the valid values for alert, see Table 5–3. Some valid values are mail, write, and quiet. |
-W minutes |
Specifies how often (in minutes) the fault alert will occur. If you don't specify this option, the alert is sent once. |
The fault alert setting is entered in the print server's /etc/lp/printers/printer-name/alert.sh file.
Check the information following the On fault heading from the output of the following command.
$ lpstat -p printer-name -l |
The following example shows how to set up the printer mars to send fault alerts by email to a user named joe, with reminders every 5 minutes.
# lpadmin -p mars -A 'mail joe' -W 5 |
The following example shows how to sets up the printer venus to send fault alerts to the console window, with reminders every 10 minutes.
# lpadmin -p venus -A write -W 10 |
The following example shows how to stop fault alerts for the printer mercury.
# lpadmin -p mercury -A none |
The following example shows how to stop fault alerts until the printer venus has been fixed.
# lpadmin -p venus -A quiet |
If you choose not to send any fault notification, you can find out about printing faults so you can correct the problem. The LP print service will not continue to use a printer that has a fault. In addition to alerts for printer faults, you can also provide alerts that tell the system administrator to mount print wheels, font cartridges, and forms when print requests require them.
You can define the fault recovery options for a printer only by using the lpadmin -F command. This task is not available in Solaris Print Manager.
Printer faults can be as simple as running out of paper or needing to replace a toner cartridge. Other more serious problems can include complete printer failure or power failure. After you fix a printer fault, the print request that was active when the fault occurred begins printing in one of three ways:
Starts printing from the beginning
Continues printing from the top of the page where printing stopped
After you enable the printer, continues printing from the top of the page where the printing stopped
A print filter is required to continue printing from the top of a page where the printing stopped. A print filter records the control sequences used by the printer to track page boundaries, which the default filters used by the print service cannot do. You will be notified by the print service if recovery cannot proceed with the specified print filter. For information about writing filters, see How to Create a New Print Filter.
If you want printing to resume immediately after a printer fault is fixed, enable the printer by using the enable command.
The following table lists the fault recovery values you can set for a printer with the lpadmin -F command.
Table 5–4 Values for Printer Fault Recovery
Log in as superuser, lp, or assume an equivalent role on the print server.
Set up fault recovery for the printer.
# lpadmin -p printer-name -F recovery-options |
-p printer-name |
Name of the printer for which you are specifying fault recovery. |
-F recovery-options |
One of the three valid recovery options: beginning, continue, or wait. For detailed information about the valid values for recovery-options, see Table 5–4. |
For more information, see lpadmin(1M).
The fault recovery setting is entered in the print server's /etc/lp/printers/printer-name/configuration file.
Check the information following the After fault heading in the output of the following command.
$ lpstat -p printer-name -l |
The following example shows how to set up the printer luna to continue printing at the top of the page where printing stopped.
# lpadmin -p luna -F continue |
You can control which users can access some or all of the available printers. For example, you can prevent some users from printing on a high-quality printer to minimize expense. To restrict user access to printers, you can create allow and deny lists using the lpadmin -u command on the print server. (Solaris Print Manager enables you to create only allow lists.) If you create neither, a printer is available to all users who can access the printer.
An allow list contains the names of users allowed access to the specified printer. A deny list contains the names of users denied access to the specified printer.
The rules for allow and deny lists are:
Allow and Deny List Rule |
User Consequence |
---|---|
Do not create allow and deny lists, or if you leave both lists empty |
All users can access the printer. |
Specify all in the allow list |
All users can access the printer. |
Specify all in the deny list |
All users, except root and lp (on the server), are denied access to the printer. |
Make any entry in the allow list |
The deny list is ignored. Only those users who are listed can access the printer. |
Create a deny list, but you do not create an allow list or you leave the allow list empty |
Users who are listed in the deny list are denied access to the printer. |
Because the print server is actually controlling access to the printer, allow and deny lists can only be created on the print server itself. If you create allow and deny lists, the print server will exclusively control user access to printers.
The following table lists the values you can add to an allow or deny list to limit user access to a printer.
Table 5–5 Values for Allow and Deny Lists
Value for user-list |
Description |
---|---|
user |
User on any system |
all |
All users on all systems |
none |
No user on any system |
system!user |
User on system only |
!user |
User on local system only |
all!user |
User on any system |
all!all |
All users on all systems |
system!all |
All users on system |
!all |
All users on local system |
Log in as superuser, lp, or assume an equivalent role on the print server.
Allow or deny users access to a printer.
# lpadmin -p printer-name -u allow:user-list [ deny:user-list] |
-p printer-name |
Name of the printer to which the allow or deny user access list applies. |
-u allow:user-list |
User names to be added to the allow user access list. You can specify multiple user names with this command. Use a space or a comma to separate names. If you use spaces, enclose the list of names in quotes. Table 5–5 provides the valid values for user-list. |
-u deny:user-list |
User names to be added to the deny user access list. You can specify multiple user names with this command. Use a space or a comma to separate names. If you use spaces, enclose the list of names in quotes. Table 5–5 provides the valid values for user-list. |
The specified users are added to the allow or deny user access list for the printer in one of the following files on the print server:
/etc/lp/printers/printer-name/users.allow
/etc/lp/printers/printer-name/users.deny
If you specify none as the value for user-list in the allow user access list, the following files are not created for the print server:
/etc/lp/printers/printer-name/alert.sh
/etc/lp/printers/printer-name/alert.var
/etc/lp/printers/printer-name/users.allow
/etc/lp/printers/printer-name/users.deny
Check the information following the Users allowed or Users denied heading in the output of the following command.
$ lpstat -p printer-name -l |
The following example shows how to allow only nathan and george access to the printer luna.
# lpadmin -p luna -u allow:nathan,george |
The following example shows how to deny nathan and george access to the printer asteroid.
# lpadmin -p asteroid -u deny:"nathan george" |
When a user submits a print request from a print client, the print request is added to a queue on the print server before it is sent to the printer. While a print request is in the queue, you can cancel or gain status information on the request from a client system. You must login to the print server to move, hold, resume, or change the priorities of print requests with LP commands. These actions can help you keep printing services operating smoothly.
The following table lists the values for changing the priority of a print request with the lp H command.
Table 5–6 Values for Changing the Priority of a Print Request
Value for -H change-priority |
Description |
---|---|
hold |
Places the print request on hold until you cancel it or instruct the LP print service to resume printing the request. |
resume |
Places a print request that has been on hold back in the queue. It will be printed according to its priority and placement in the queue. If you put a hold on a print job that is already printing, resume puts the print request at the head of the queue so it becomes the next request printed. |
immediate |
Places a print request at the head of the queue. If a request is already printing, you can put it on hold to allow the next request to print immediately. |
Log in on any system on the network.
Check the status of printers and print requests.
Only the most commonly used options are shown here. For other valid options, see lpstat(1).
$ lpstat -o [list] | -u [user-list] |
When used to check the status of print requests, the lpstat command displays one line for each print request. From left to right, the line shows the request ID, the user, the output size in bytes, the date and time of the request, and information about the request, such as “being filtered.”
The following example shows that user fred has one print request queued to the printer luna.
$ lpstat luna-1 fred 1261 Jul 12 17:34 |
The following example shows that the user paul currently has no print requests in queue.
$ lpstat -u paul |
The following example shows that there are two print requests on the printer moon.
$ lpstat -o moon moon-78 root 1024 Jul 14 09:07 moon-79 root 1024 Jul 14 09:08 |
The enable and disable commands control whether a printer prints or stops printing requests that are in the print queue. When you disable a printer, the printer stops printing requests in queue. However, requests are still added to the queue. (You must set the printer to reject print requests so requests are not added to the queue. For information about rejecting print requests, see Accepting or Rejecting Print Requests.)
A printer is enabled to print and accepts print requests when it is added by using Solaris Print Manager. Solaris Print Manager doesn't provide any additional printer processing management.
You must enable the printer whenever it has been disabled, which can happen when a printer fault occurs. When you enable a printer, it prints requests from the print queue until the queue is empty, even if the print service rejects additional requests for the print queue.
The following figure shows the point at which processing of print requests is interrupted when a printer is disabled.
Log in as superuser, lp, or assume an equivalent role on the print server.
Stop printing print requests.
# disable [-c | -W] [-r "reason"] printer-name |
You cannot enable or disable classes of printers. Only individual printers can be enabled or disabled.
Start printing print requests.
# enable printer-name |
Verify that the printer is enabled.
$ lpstat -p printer-name |
The following example shows how to stop the current job on the printer luna, save it to print later, and provide a reason why the printer has stopped printing print requests.
# disable -r "changing the form" luna |
The following example shows how to start printing print requests on the printer luna.
# enable luna printer "luna" enabled |
The accept and reject commands enable you to turn on or turn off a print queue that stores requests to be printed.
When you use the reject command, the print queue for a specified printer is turned off. No new print requests can enter the queue on the print server. All print requests that are in the queue are still printed. You must disable the printer if you want it to stop printing requests that are already in the queue. The following table compares the functions of the accept, reject, enable, and disable commands.
Table 5–7 Functions of accept/reject and enable/disable Commands
Command |
Function |
---|---|
accept |
Accept print requests that are sent to the print queue. |
enable |
Print the requests that are in the print queue. |
reject |
Reject print requests that are sent to the print queue. |
disable |
Stop printing requests that are currently in the print queue. |
If a print request is rejected, the print service writes or mails a message to the user who submitted the request, saying that print requests are not being accepted for the specified printer.
You can also specify a reason for not accepting requests through the command line. The reason is displayed on users' systems when one tries to check the printer's queue. The following figure shows the point at which processing of print requests is interrupted when a print queue rejects print requests.
Log in as superuser, lp, or assume an equivalent role on the print server.
Stop accepting print requests for the printer.
# reject [-r "reason"] printer-name |
-r "reason" |
Provides users a reason why the printer is rejecting print requests. The reason is stored and displayed whenever a user checks on the status of the printer with the lpstat -p command. |
printer-name |
Name of the printer that will stop accepting print requests. |
The queued requests will continue printing as long as the printer is enabled. For instructions on disabling a printer so it stops printing, see How to Enable or Disable a Printer.
Start accepting print requests for the printer.
# accept printer-name |
Check that the status of the printer to see whether it is accepting or rejecting print requests.
$ lpstat -p printer-name |
The following example shows how to stop the printer luna from accepting print requests.
# reject -r "luna is down for repairs" luna destination "luna" will no longer accept requests |
The following example shows how to set the printer luna to accept print requests.
# accept luna destination "luna" now accepting requests |
You can use the cancel command to cancel print requests from printer queues or to cancel jobs that are printing. There are three ways to use the cancel command:
Cancel requests by request identification number (request ID)
Cancel requests from a specific user on all, or specified, printers
Cancel the job currently printing
When you use the cancel command, a message tells you the request(s) are canceled, and the next request in queue is printed. You can cancel a print request only if you are:
The user who submitted the request and you are logged in on the system from which you submitted the request
The user who submitted the request on any client system and the print server has the “user-equivalence” option configured for the printer in it's /etc/printers.conf file.
Logged in as superuser or lp or have assumed an equivalent role on the print server.
To cancel a specific request, you need to know its request ID. The request ID is comprised of the name of the printer, a dash, and the number of the print request. For example, luna-185.
When you submit the print request, the request ID is displayed. If you do not remember the print request ID, you can find it by using the lpstat command with the -o printer option.
If you are going to cancel print requests of other users, become superuser, lp, or assume an equivalent role.
Determine the request IDs of the print requests to cancel.
# lpstat |
For more details, see How to Check the Status of Print Requests.
Cancel a print request.
$ cancel request-id | printer-name |
Verify that the print requests are canceled.
$ lpstat -o printer-name |
The following example shows how to cancel the luna-3 and luna-4 print requests.
$ cancel luna-3 luna-4 request "luna-3" cancelled request "luna-4" cancelled |
The following example shows how to cancel the print request that is currently printing on the printer luna.
# cancel luna request "luna-9" cancelled |
(Optional) Become superuser, lp, or assume an equivalent role if you are going to cancel print requests of other users.
Cancel a print request from a specific user.
$ cancel -u user-list [printer-name] |
The following example shows how to cancel all the print requests submitted by the user george on the printer luna.
# cancel -u george luna request "luna-23" cancelled |
The following example shows how to cancel all the print requests submitted by the user george on all printers.
# cancel -u george request "asteroid-3" cancelled request "luna-8" cancelled |
If you plan to change the way a printer is used or decide to take a printer out of service, you should set up the LP print service to reject additional print requests, and then move or cancel any requests that are currently queued to the printer. You can use the lpmove command to move individual or all print requests to another local printer.
Request IDs are not changed when you move print requests, so users can still find their requests. Print requests that have requirements (such as file content type or forms) that cannot be met by the newly specified printer cannot be moved. They must be canceled.
To move all print requests from one printer to another, you do not need to know the request IDs. However, it is a good idea to see how many print requests are affected before you move them.
Log in as superuser, lp, or assume an equivalent role on the print server.
(Optional) Check the request IDs of the print requests on the original printer.
# lpstat -o printer-name1 |
(Optional) Check to see if the destination printer is accepting print requests.
# lpstat -p printer-name2 |
-p printer-name2 |
Name of the printer to which you are moving the print requests. |
Move all the print requests from the original printer to the destination printer.
# lpmove printer-name1 printer-name2 |
printer-name1 |
Name of the printer from which all print requests will be moved. |
printer-name2 |
Name of the printer to which all print requests will be moved. |
For more information, see lpmove(1M).
If some requests cannot be printed on the destination printer, they are left in the original printer's queue. By using request IDs, you can also move specific print requests to another printer with the lpmove command.
Start accepting print requests on the original printer.
If you move all the print requests to another printer, the lpmove command automatically stops accepting print requests for the printer. This step is necessary if you want to begin accepting new print requests for the printer.
# accept printer-name1 |
Check for any remaining print requests in the original printer's queue.
$ lpstat -o printer-name1 |
Make sure all specified print requests were moved to the destination printer's queue by using the following command.
$ lpstat -o printer-name2 |
The following example shows how to move print requests from the printer luna to the printer terra, and then tells the original printer luna to resume accepting print requests.
# lpmove luna terra # accept luna |
After a user has submitted a print request, you can change its priority in the print server's queue by:
Putting any print request on hold if it has not finished printing. Putting a request on hold stops it, if it is currently printing, and keeps it from printing until you resume printing it. Other print requests go ahead of the on-hold request.
Moving any print request to the head of the queue, where it will be the next job eligible for printing. If you want a job to start printing immediately, you can interrupt the job that is currently printing by putting it on hold.
Changing the priority of a job still waiting to be printed, moving it in the queue so it is ahead of lower priority requests and behind requests at the same level or at a higher priority.
Log in as superuser, lp, or assume an equivalent role on the print server that is holding the print request.
Determine the request IDs of the print requests whose priority you want to change.
# lpstat |
For more information, see How to Check the Status of Print Requests.
Change the priority of a print request.
# lp -i request-id -H change-priority |
-i request-id |
Request ID of a print request you want to change. You can specify multiple request IDs with this command. Use a space or a comma to separate request IDs. If you use spaces, enclose the list of request IDs in quotes. |
-H change-priority |
One of the three ways to change the priority of a print request: hold, resume, immediate. For detailed information about valid values for change-priority, see Table 5–6. |
You can also use the lp -q command to change the priority level of a specified print request. You can change the priority level from 0, the highest priority, to 39, the lowest priority.
The following example shows how to change a print request with the request ID asteroid-79, to priority level 1.
# lp -i asteroid-79 -q 1 |