Operating System Information --> Unix Information --> Unix Utilities --> UNIX: Using The mpage Command To Print Multiple Pages On One Piece Of Paper -->

UNIX: Using The mpage Command To Print Multiple Pages On One Piece Of Paper

To print multiple pages on one piece of paper on a UNIX system, the mpage command is used.

The Basic Command

An example of the basic use of this command is:

  mpage -2 filename.txt

This example would print the contents of the file filename.txt, reduced in size so that two pages fit on each sheet of paper, on your default printer.

You can use -2, -4, or -8 to print a different number of pages per sheet of paper.

Printing multiple files on one piece of paper

The mpage command will accept more than one filename on the command line, and print all of them. However, by default, it will print each file on a separate sheet of paper. If you want multiple files printed on one sheet of paper, use the concatenation option. An example of this is:

  mpage -4 -c filename1.txt filename2.txt

This example would print all the pages of filename1.txt, followed immediately by all the pages of filename2.txt, reduced in such a way that 4 pages would fit on one piece of paper. If filename1.txt were 1 page long, and filename2.txt were 2 pages long, one sheet of paper would be output, containing 3 pages and one blank rectangle.

Printing a postscript file

If you give mpage the filename of a postscript file, it may not work. The symptom is that no output will appear on the printer, and you'll receive an e-mail message explaining that there was an error printing the document.

If this happens, force mpage to interpret the file as a postscript file. To do this, use the following command:

  mpage -4 -dp filename.ps

This would print the file filename.ps 4 pages per sheet of paper.

Setting the default printer

The mpage command will print using your default print command. To change the default print command temporarily, the syntax is:

  setenv PRINT "print command"

where print command is a properly formatted qpr command. An example of an appropriate print command is:

  qpr -q mckeldin

This command would print in the OIT Computer Lab in McKeldin library. The whole command to reset the default print command to print in McKeldin is:

  setenv PRINT "qpr -q mckeldin"

If you always, or almost always, print to the same printer, you might prefer to reset the default printer permanently. To do this in the TerpConnect system, edit your .environment file, and add the following line at the bottom:

  setenv PRINTER printername

where printername is the queue name for your preferred printer.

On the TerpConnect system, the value of the PRINT environment variable is automatically set on login, based on the value of the PRINTER environment variable. Therefore, you only need to change the value of the PRINT environment variable in your .environment file.

You can determine what the values of the PRINT and PRINTER environment variables are with the following commands:

  echo $PRINT

  echo $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