InomHitta mer dokumentationSupportresurser som ingår | Ladda ner denna bok i PDF (736 KB)
Chapter 8 Using PrintersThe line printer subsystem (LP) print service provides the printing tools that are used in the Solaris operating environment. LP provides a wide variety of functions, many of which are not within the scope of this manual. This chapter provides the procedures necessary for you to perform the following basic printing tasks with the LP print service: See System Administration Guide: Advanced Administration for a complete description of the LP print service. Submitting Print RequestsTo print a file from the command prompt, use the lp command to send a request to the printer to print that file. When a request is made, the LP print service places it in the queue for the printer, displays the request ID number, and then redisplays the shell prompt. Submitting Print Requests to the Default PrinterWhen your system administrator sets up the LP print service with a default printer, you can submit print requests without typing the name of the printer by typing the following command.
In the previous example, filename is the name of the file you want to print. The specified file is placed in the print queue of the default printer, and the request id is displayed. For example, to print the /etc/profile file, type the following command.
See System Administration Guide: Advanced Administration for information on how to specify a default printer. Submitting Print Requests Using a Printer NameWhether or not a default printer has been designated for your system, you can submit print requests to any printer that is configured for your system. To submit a print request to a specific printer, type the following command.
In the previous example, printername is the name of the specific printer and filename is the name of the file you want to print. The specified file is placed in the print queue of the destination printer, and the request id is displayed. For example, to print the /etc/profile file on the printer fastprint, type the following command.
If you submit a request to a printer that is not configured on your system, an information message is displayed, as shown in the following example.
See System Administration Guide: Advanced Administration for information on configuring printers. See Determining Printer Status for information about how to find out which printers are available on your system. Requesting Notification When Printing Is CompleteWhen you submit a large file for printing, you might want the LP print service to notify you when printing is complete. You can request that the LP print service notify you in two ways:
To request email notification, use the -m option when you submit the print request.
To request a message be written to your console window, use the -w option when you submit the print request.
In the previous example, filename is the name of the file you want to print. Printing Multiple CopiesYou can use the -n option to the lp command to print more than one copy of a file. Use the following command syntax to request multiple printed copies.
In the previous example, number is the desired number of copies and filename is the name of the file you are printing. The print request is considered as one print job, and only one header page is printed. For example, to print four copies of the /etc/profile file, type the following command.
Summary Table of lp OptionsYou can use options to the lp command to customize your print request. Table 8–1 summarizes the frequently used options for the lp command. You can use these options individually or combine them in any order on the command line. When you combine options, use a space between each option and repeat the dash (-). For example, to specify a destination printer, request email notification, and print six copies of a file, type the following command.
In the previous example, printername is the name of the desired printer and filename is the name of the file you want to print. Table 8–1 Summary of Frequently Used lp Options
See the lp(1) man page for a complete list of options. Determining Printer StatusUse the lpstat command to determine the status of the LP print service. You can check the status of your own jobs in the print queue, determine which printers you can use, or determine request ids of your jobs if you want to cancel them. Checking on the Status of Your Print RequestsType the following command to find out the status of your print requests.
A list of the files that you have submitted for printing is displayed. In the following example, one file is queued for printing to the printer jetprint.
The lpstat command displays one line for each print job, showing the request id, followed by the user who spooled the request, the output size in bytes, and the date and time of the request. Checking Available PrintersTo find out which printers are configured on your system, type the following command.
The status of the scheduler is displayed, followed by the default destination and a list of the systems and printers you can use. In the following example, the scheduler is running, the default printer is jetprint, and the print server for the jetprint and fastprint printers is prtsrv1.
Displaying All Status InformationThe -t option for lpstat gives you a complete listing of the status of the LP print service. To display a complete listing of all status information, type the following command.
The system displays all available status information. In the following example, no jobs are in the print queue. When files are spooled for printing, the status of those print requests is also displayed. Displaying Status for PrintersYou can use the -p to the lpstat command to request printer status information for individual printers. This option shows whether the printer is active or idle, when the printer was enabled or disabled, and whether the printer is available to accept print requests. To request status for all printers on a system, type the following command.
In the following example, two printers are idle, enabled, and available.
If one of those printers had jobs in the print queue, those jobs would also be displayed. To request status for an individual printer by name, type the following command.
In this example, printername is the name of the specific printer. Summary Table of lpstat OptionsYou can use the lpstat command to request different types of printing status information. Table 8–2 summarizes the frequently used options for the lpstat command. Use these options individually, or combine them in any order on the command line. When you combine options, use a space between each option and repeat the dash (-). Table 8–2 Summary of Frequently Used lpstat Options
See the lpstat(1) man page for a complete list of options. Canceling a Print RequestUse the cancel command to cancel a print request while it is in the queue or while it is printing. To cancel a request, you need to know the print request id. The request id always includes the name of the printer, a dash, and the number of the print request. When you submit the print request, the request id is displayed. If you do not remember your request id, type lpstat -o and press Return. Only the user who submitted the request, or someone logged in as root or lp can cancel a print request. Canceling a Print Request by ID NumberTo cancel a print request, type the following command.
In the previous example, request_id is the request id number of the desired print request. A message informs you that the request is cancelled. The next job in the queue begins printing. In the following example two print requests are canceled.
Canceling a Print Request by Printer NameYou can also cancel just the job that is currently printing (if you submitted it) by typing the printer name in place of the request id.
In the previous example, printername is the name of the printer to which you sent the request. A message informs you that the request is canceled. The next job in the queue begins printing In the following example, the current print request has been canceled.
Your system administrator can log in as root or lp and cancel the currently printing request by using the printer name as the argument for the cancel command. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||