University Systems --> WAM --> Page Has Been Retired --> Printing from your WAM Account --> How to print in Unix -->

How to print in Unix

Printing from the command line

The basic command for printing is the qpr command. The command takes on the following form:

qpr [-q printer] [-options] filename(s)

For example, if you wanted to print a file called "myfile" to the Hornbake Library printer, you would type:

qpr -q hornbake myfile

Note that hornbake is the name of the printer.


Pay for Print (LPCR) Printers

Some printers require you to pay 10 cent per page to print to them.

The syntax for qpr is:

qpr [-q queue] [-m cents] filename(s)

You will be prompted for your print account and password, for example:

rac3:~: qpr -q pg2 -m 10 testfile
Print account? [nothing is shown]
Print account password? [nothing is shown]

The default page limit value is 100 cents (10 pages).

This command sent the file called "testfile" to the pg2 printer, with a page limit of 10 cents. If testfile was more than 1 page, the other pages would not have printed out.


Other Options

An additional flag that you can pass to qpr is the -x flag. With this flag, you can specify extended arguments, like if you want to print in landscape format and you can also specify if you want to print on both sides of the paper. To print in landscape format to the default printer (as specified in the PRINTER variable, see below) you have to issue the following command

qpr [-q printer] -x landscape filename(s)

If you substitute duplex forlandscape, you will be able to print on both sides of the paper. Note, however, that the printer you are printing must support duplex printing. The only public printer that supports duplex is csc located at the Dispatch entrance of the A. V. Willaims Building.


WAM or Glue Prompt

Use the qpr command to send a file to the printer. The default printer is defined in the environment variable PRINTER.


Using xqpr on the Sun Sparcstations ( Glue and WAM only)

When you print on the Windows and the Macintosh workstations, you will get a graphical user interface prompting you for your Print Account and its Password. A similar interface is available on the Sun Sparcstations which is invoked by the xqpr command. All commands print to the default printer (defined in the environment variable PRINTER) unless you specify otherwise.

The procedure for printing from an application varies.

  • If the print command for the application is set to use xqpr instead of qpr, the xqprwindow will open for you to enter your print account data. This will bring up a window like shown below.

    xqpr screen shot

    Fill in the fields "Print Account Number" and "Print Account Password." You can select a different printer if you want at the bottom and click on "Print" to print the file.

  • If xqpr isn't the default print command for the application, invoke the application from the command-line prompt without backgrounding the application. The qpr software will prompt for your print account data in the Xterm from which you invoked the application.

To print to a specific printer, either change your environment variables, or print to a postscript file (.ps) and then print to a specific queue from the command line. for example: qpr -q cscsun filename.ps.

To print from an Xterm prompt without using xqpr, use the qpr command.


Using the PRINTER variable

When you print to using the qpr command but don't specify a printer, the print job will be sent to the default printer. If you find yourself using the same printer, you can set it as the default so you don't have to specify the printer name every time you print a document. For example, if you want to set the default printer to the hornbake you would type the following at the command prompt:

setenv PRINTER hornbake

You can substitute in any printer name you want for hornbake. So if you want to print to that printer, you can simply issue the command

qpr myfile

If you want to find out what the PRINTER variable has been set to, you can issue the following command:

echo $PRINTER

It will echo back the value of the variable.

On Glue and WAM systems you would add the "setenv PRINTER" command into the .environment file to have it set automatically each time you log in.

Open the .environment file with your favorite text editor. To use pico you would type in at the command prompt:

pico ~/.environment

and add at the end the following:

setenv PRINTER someprintqueue

where someprintqueue is the print queue you want and press the control key and the x key at the same time to save the .environment file.


Using the mpage Command

If you want to print multiple pages on one sheet of paper, you can use the mpage command. Consider the following example:

mpage -2 -c myfile 

This command would print out the contents of myfile in way so that every 2 pages of the file would print out on 1 sheet of paper. If myfile normally occupies 8 pages, the output, using this command, will be 4 sheets of paper. The first paper will have the first 2 pages of myfile and the second paper will have 2 pages of myfile, etc.... The output will be sent to the default printer, as specified by the PRINTER variable.


Using man -t to Print Formatted man Pages

The man command provides information on the Unix commands. If you type

man pico

at the command line, you will get information on the pico command. If you want to print out the information, you can use the man command with the -t flag. Instead of sending the information to the screen, it will send that information to the printer, as specified by the PRINTER variable. For example, if you want to print out information about Pico to the default printer, use the following command:

man -t pico

The output will come out formatted (just like you would see it on the screen) at the printer.

How do I:
How are we doing? Comments on this page?
Office of Information Technology
Office of Information Technology Help Desk Web Site University of Maryland Web Site Office of Information Technology Web Site