ORNL Physics Division
Managed by UT-Battelle for the Department of Energy
Search     Go!

Division Computing
CUPS Printing

Printing via the command line on Linux Desktops in the Physics Division

  • Get a list of available printers: lpstat -p
  • Print a file: lpr [-Pprinter] filename if -Pprinter is omitted the file is send to the default printer.
  • Get the queue status: lpq [-a] [-Pprinter] -a lists all active jobs and -Pprinter lists the queue for the indicated printer.
  • lprm -Pprinter jobnumber : dequeues a printjob.
  • Passing options to the printer: lpr [-Pprinter] -o option filename options available for most printers are:
    • -o media=size : sets the page size. i.e. "A4", "letter"
    • -o landscape : rotate 900
    • -o sides=one-sided : print on one side
    • -o sides=two-sided-long-edge : print on both sides (opens like a book)
    • -o sides=two-sided-short-edge : print on both sides (opens like a flip chart)
    • -o fitplot : scales the print file to fit on the page
    • -o scaling=number : scale image where number is percent
    • -o cpi=N : sets number of characters per inch to use for text file
    • -o lpi=N : sets number of lines per inch to use for text file
    • -o job-sheets=none to suppress the banner page
    • -o page-ranges=1-4,7,9-12 (or similar) : select pages to print
    • -o number-up=[1,2,4] : allows to print 1, 2 or 4 pages on one sheet of paper
    • -o prettyprint : puts a header at the top of each page with the page number, job title (usually the filename), and the date. C and C++ keywords are highlighted, and comment lines are italicized
    • -o page-bottom=N : bottom margin (72=1 inch)
    • -o page-left=N : left margin (72=1 inch)
    • -o page-right=N : right margin (72=1 inch)
    • -o page-top=N : top margin (72=1 inch
    In addition some printers have additional options like duplexing and stapleing. These options are used exactly as the one listed above. To see the options available for a given printer: lpoptions -p printer -l if -p printer is omitted, options are shown for the default printer.
  • Set default printer : lpoptions -d printer
  • Setting personal preferences for a printer: lpoptions [-pprinter] -o option sets the desired options for the indicated printer for later use.
  • Printer instances: For example: To create a print queue for a printer named ps01 with the default behavior of printing on both sides
  • lpoptions -p ps01/duplex -o sides=two-sided-long-edge Then: lpr -P ps01/duplex filename will print in duplex mode to ps01.
  • Options can be removed via: lpoptions -x
More information can be found at: http://phylog.phy.ornl.gov:631/help/options.html

Commonly used options for some printers

  • To use duplex printing: ps01: lpr -o sides=two-sided-long-edge