r5 - 12 Sep 2007 - 16:18:20 - StevenHenkeYou are here: TWiki >  TechHelp Web > PrintHelp > UnixPrintCommands

Unix Printing with CUPS

SCS uses the Common Unix Printing System (CUPS) to manage printing jobs. If you already have CUPS installed on your system, place the following into your client.conf file (usually /etc/cups/client.conf)

    ServerName printers.scs.fsu.edu

Remember to restart cupsd after saving the changes to the file.

Printing from the Command Line

For historical reasons, there are two functionally-equivalent printing systems available for UNIX platforms. CUPS supports both systems, so the choice is a matter of user preference.

Description BSD System V
Submit a print job lpr FILENAME lp FILENAME
Display printer status/queues lpq lpstat
Cancel a print job lprm JOB_ID cancel JOB_ID

Where FILENAME is the name of the file to be printed, and JOB_ID is the job identification number (use lpq to determine this).

Basic Examples

Printing to a non-default printer:

This example demonstrates the switches necessary to print to any printer other than your default printer. In this case we will be printing to pr420:
    lpr -P pr420 FILENAME
    lp -d pr420 FILENAME

You will note that the -P and -d options are the only differences between the print commands. We will use lpr for examples

Printing multiple copies

If a user wishes to print some number of copies of a file, the following form of the command would be useful:

    lpr -#NUMBEROFCOPIES FILENAME

Customizing Printer Options

For most jobs, the default printer options will be sufficient for your needs. However, there may be times when you need to change the options for a special job that you are printing. In such a scenario, we have two methods for passing options to a printer:

The lpr and lp print commands allow you to pass printer options using the -o option. A small sample of the options available include:

  lpr
   -o landscape                      landscape (rotates page 90 degrees)
   -o media=legal                    print on legal paper
   -o collate=true                   to get collated copies

NOTE: to print on legal paper on all printers except pr420, you will need to also to specify manual feed (unless there is a tray for legal paper in the machine).

Alternatively, lpoptions will allow you to view and modify printer options, as well as save your preferences to a file.

    lpoptions -o one-sided 
    lpoptions -p pr424 duplex=none number-up=2 

These commands will create a file named .lpoptions in your home directory:

    pamd:~> cat .lpoptions
    Default pr420 sides=one-sided
    Dest pr424 Duplex=None number-up=2

NOTE: the lpoptions command is not available on all systems at this time.

For additional information on printer options, see the CUPS Software Users Manual.

Duplexing

The -o sides=two-sided-short-edge and -o sides=two-sided-long-edge options will enable duplexing on the printer, if the printer supports it. Specifying -o sides=two-sided-short-edge would be suitable for landscape pages, while -o sides=two-sided-long-edge would be suitable for portrait pages:

    lpr  -o sides=two-sided-short-edge FILENAME
    lpr  -o sides=two-sided-long-edge FILENAME

The default is to print single-sided

    lpr -o sides=one-sided FILENAME

NOTE: the default on SCS printers is to print single-sided on all printers except for pr420, where the default is to print double-sided (duplex).

Add a Comment

A list of the defined general use -P lpr print queues would be very nice here. Steve Thompson 11-29-05

-- SteveThompson - 29 Nov 2005

 

Last changed: 12 Sep 2007

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r5 < r4 < r3 < r2 < r1 | More topic actions
 
SCS TWiki

This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback