This is a quick reference to the commands and print job options a user can use from command line in order to print documents. Although print dialogs have evolved, it’s many times necessary to send a document to the printer with some extra options. For detailed explanation of each command’s functionality please refer to the CUPS user documentation.
This document assumes that you have already set up your CUPS printer. This task is rather easy. Here is a list of software that can assist you in installing the printer in Fedora:
- CUPS Web Interface – Point your web browser to http://localhost:631
- printconf-gui or printtool – Graphical programs.
- printconf-tui – The same programm running in text-mode.
- lpadmin – Shell program for non-interactive printer setup.
Print a document
As a user, in order to print to the default printer, issue the command:
# lpr filename
Print to specific printer:
# lpr -P printer filename
Print multiple copies. For example, in order to print 4 copies:
# lpr -P printer -#4 filename
CUPS status information
As a user, issue the lpstat command with proper options:
# lpstat <options>
Options can be:
- -t : show all CUPS info
- -d : show default printer
- -p : show all printers
- -a : show all printers that accept jobs
- -o : show active print jobs
Cancel a print job
As a user, issue the command:
# lprm <job-id>
Only the jobs that have been submitted by the same user can be canceled.
Setting options for a specific print job
Sometimes, the user needs specific print options. A general way to define specific options for a print job is:
# lpr -P printer -o option1=value -o option2=value filename
Modify the default print options
A user can define his own options for all his print jobs for a specific printer. They are saved in the ~/.lpoptions file and override the default options that have been defined by the system administrator for this specific CUPS printer.
Add or modify print options
A user can set his own default options for a specific CUPS printer by issuing the command:
# lpoptions -p printer -o option1=value -o option2=value
Remove print options
Previously defined print options can be removed from ~/.lpoptions by:
# lpoptions -p printer -r option1 -r option2
List a printer’s options
To list print queue’s current options:
# lpoptions -p printer
To list print queue’s current options:
# lpoptions -p printer -l
Create sets of options – Printer Instances
A very useful CUPS feature is that sets of options can be defined. These can be system-wide if they are set by root, or user specific if they are set by a user. Printer instances are extra options for a specific printer that are saved as an extra printer in the form printer/set. This virtual printer’s settings override the default options.
To create a printer instance, as a user issue the command:
# lpoptions -p printer/set1 -o option1=value -o option2=value
To delete a printer instance issue the command:
# lpoptions -x printer/set1
The printer instance is listed as a printer in lpstat.
The user can send a document to the printer instance:
# lpr -P printer/set1 filename
Appendix I – Common print options
Some common print options are listed below. If an option accepts a value, then it is listed in the form option=value:
- landscape – for landscape printing
- media=A4 – check your ppd file for possible media values
- Collate=true | false – useful when printing multiple copies
- sides=two-sided-short-edge – used for landscape prints [the default is sides=one-sided]
- sides=two-sided-long-edge – used for portrait prints [the default is sides=one-sided]
- page-ranges=1-4,7,9-12 – print specific pages or page ranges
- page-set=odd | even – print only odd or even pages
- outputorder=normal | reverse – the pages are printed from first to last or the other way around
- cpi=10 – characters per inch
- lpi=6 – lines per inch
- columns=2 – format the text in two or more columns
- page-left=value – specify the left margin in points [1pt = 1/72inch]
- page-right=value – specify the right margin in points [1pt = 1/72inch]
- page-top=value – specify the top margin in points [1pt = 1/72inch]
- page-bottom=value – specify the bottom margin in points [1pt = 1/72inch]
- job-sheets=none – front and back cover pages
Read the full CUPS user manual at http://www.cups.org/doc-1.1/sum.html
Using a CUPS printer from command line by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2005 - Some Rights Reserved