Using a CUPS printer from command line


This article will guide you through the process of using your CUPS printer by issuing commands in the terminal and also outlines the available print job options you can set in order to fine tune the final prints.

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
  • job-sheets=standard
  • job-sheets=classified,classified

Further Reading

Read the full CUPS user manual at

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

George Notaras avatar

About George Notaras

George Notaras is the editor of the G-Loaded Journal, a technical blog about Free and Open-Source Software. George, among other things, is an enthusiast self-taught GNU/Linux system administrator. He has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora. He has also developed some open-source software projects in his spare time.

5 responses on “Using a CUPS printer from command line

  1. Portrait From Photo Permalink →

    Great tips pal!

    Are these commands applicable to all printers? Is this also useful when printing photos? What kind of printer best uses these commands?

    I’d like to optimize the use of my own printer when I’m printing photos of my clients and customers and so I’m asking you those query.

    Thanks and more power.


  2. George Notaras Post authorPermalink →

    Hi, all these commands/utilities are part of the CUPS package and are not printer-specific. Also, some of the available print options apply to text printing and others apply to image printing. There are a lot more, but it would be better to check the CUPS documentation to get a better view.

    If the printer driver does not support some of the options, they will have no effect in the final print. Unfortunately, I am not expert with printers, so I cannot recommend any specific printer for use under linux. You may find this link useful:

    Thanks for the heads-up!

  3. Max Hoffmann Permalink →

    thanks for the tips. Do you know of a way to include shell commands in the options? My problem is: we have a printing quota and a fairly stupid counter that counts a page printed one side only as two pages since default is duplex. If one sets sides=one-sided its being counted as only one page but one get simplex only. So I would like to call pdftk to find out how many pages my document has. And if it is only one set sides=one-sided.

    Best regards,

  4. George Notaras Post authorPermalink →

    Hi Max, I have no clue of how this would be possible without hacking the CUPS backend that is used for the prints…

  5. MFR Permalink →

    thanks for the tips, do you know how to show total pages at terminal?