Skip to main content.
Arizona State University College of Liberal Arts and Sciences
Department of Mathematics and Statistics
Navigation:

Home

Search





Linux Printing Options

CUPS, the Common Unix Printing System, is considered by many to be the next generation in printing under Unix, replacing the Line Printer Daemon (LPD) designed in the 70's.It is possible to set your printing options graphically as in Windows or through the command line.

The command lp sends a file to a printer.The CUPS version of lp understands a variety of formats including, text, PostScript, and PDF. Many GUI programs, such as Mozilla and Acrobat, will print by passing arguments through LPR.

Setting Print Options on the Command Line

Some of the feature command sets for CUPS are listed below and are also available from 'man printoptions':

  • Printing non text/postscript documents from the command line:
    • lp acrobatdocument.pdf

  • Setting Duplex Printing (two-sided-long-edge is default):
    • lp -o sides=one-sided mydocument
    • lp -o sides=two-sided-long-edge mydocument
    • lp -o sides=two-sided-short-edge mydocument

  • Setting the media type (duplex is on by default, so turn it off):
    • lp -o media=Transparency -o sides=one-sided mydocument
    • lp -o media=Letterhead -o sides=one-sided mydocument

  • Print on Letterhead for first page, Plain for remaining pages:
    • lp -o sides=one-sided -o 1:media=Letterhead -o media=Plain mydocument

  • Print page ranges:
    • lp -o page-ranges=5 mydocument
    • lp -o page-ranges=2-5 mydocument
    • lp -o page-ranges=2-5,7-9 mydocument

  • Print multiple copies:
    • lp -n num copies -o collate=True mydocument

  • Setting Default Options:

    The printing options above can also be used to set default options for future print jobs. Use the lpoptions command with the same arguments above. The options will be saved in the .lpoptions file in your home directory. The following example will set 1/2" margins and make text smaller:

    • lpoptions -o page-left=36 -o page-right=36 -o page-top=36 -o page-bottom=36 lpoptions -o cpi=12 lpoptions -o lpi=7

lpstat Command

The lpstat command displays information about the current status of the line printer.If no flags are given, lpstat prints the status of all requests made by the lp command.If you specify a flag with no parameters, all information pertaining to that flag is printed.

Flags

  • -a List - Provides status and job information on queues.
  • -o List - Prints the status of print requests or print queues. List is a list of intermixed printer names and job numbers.
  • -s - Displays a status summary, including a list of printers and their associated devices.
  • -u List - Prints the status of all print requests for users specified in List. List is a list of login names.

To print to a printer other than the default printer,the following command can be used:

lp -d destination mydocument

The lp command submits files for printing or alters a pending job.

Another command that can be used to print files in linux is the lpr command.

lpr -P <name of printer> mydocument

For more on lp and lpr, please refer to the man pages.