Working with files and directories

Printing a file

When you issue a print command, a copy of the file to be printed is spooled. It then waits in the print queue, along with other print jobs, until its turn comes to be printed. Because the system spools print jobs, you can go straight on to another task.

To print a file use the lp(C) (line printer) command. For example:

   $ lp myfile
   request id is laserwriter-635 (1 file)
This command sends myfile to the print queue. The ``request id'' line means that the file will be printed on the printer named ``laserwriter'', and is request number 635.

To print several files, add them to the command line, as follows:

   $ lp file1 file2 file3
This command line prints file1, followed by file2, followed by file3.

Note that it is a bad idea to print executable programs, or other files containing binary data; in general you should only print files containing text, or containing some form of data intended for printing (such as PostScript® files).

By default, files are printed in portrait orientation on the paper: to print a file in landscape orientation (that is, sideways, so that long lines fit on the page), use the following command:

   $ lp -ol file1
To print a PostScript file on a PostScript printer, you should specify that the file contains PostScript, by using the following command:
   $ lp -og
See lp(C) for more information about how to send files to the printer.

If you need to add page numbers to a long file, use the pr(C) command, which prints files to its standard output, separated into pages with a header containing the page number and date and time of printing. You can then pipe the paginated output to lp.

For example, to print /etc/profile in this way, use the following command line:

   $ pr /etc/profile | lp

Next topic: Printing several copies of a file
Previous topic: Changing the group of a file

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003