University Systems --> TerpConnect --> Printing --> How to print in Unix -->

How to print in Unix

The basic command for printing is the qpr command. The command syntax has the following form:

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

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

  qpr  -q  mckeldin  myfile

Note that mckeldin is the name of the printer.

An additional flag that you can pass to qpr is the -x flag. With this flag, you can specify extended arguments. For example, if you want to print in landscape format (instead of the default portrait format). 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 for landscape, you will be able to print on both sides of the paper. Note, however, that the printer to which you are printing must support duplex printing.

Use the qpr command to send a file to the printer. The default printer is defined in the PRINTER environment variable. Note: As of Fall 2008, UNIX accounts can no longer print in the OIT Computer Labs.

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.

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

  echo $PRINTER

It will echo back the value of the variable.

On the TerpConnect system 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. For example, to use pico you would type in at the command prompt:

  pico ~/.environment

and add at the end the following:

  setenv  PRINTER  printqueue

where printqueue is the print queue you want. To save and exit, press control-x, then "Y", then press Enter.

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 two pages of the file would print out on one sheet of paper. If "myfile" normally occupies eight pages, using this command the output will be four sheets of paper. The first sheet will have the first two pages of "myfile" and the second sheet will have the next two pages, etc... The output will be sent to the default printer, as specified by the PRINTER variable.

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

  man pico

at the command prompt, 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 option. 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 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