UNSW   Faculty of Engineering PRINT VERSION SITE MAP  
cse | School of Computer Science and Engineering (CRICOS Provider No. 00098G)
    #About CSE     #Undergraduate Study     #Postgraduate Study     #Timetables & Courses     #Research & Publications     #People & Work Units     #Help & Resources     #News & Events     #High School Portal

Last updated 19.02.08


Sending a Job to the Printer

To print files on any of the School's printers you use the lpr command. This used to be short for Line PRinter. The command pr (for PRint) does something completely different. Check the manpage for details.

A list of available printers can be found in table 1.2 on page [*]. The general form of the lpr command is:

    lpr -Pprintername filename

For example, to print the postscript file poem.ps on the printer stu you would type

        
    % lpr -Pstu poem.ps

Similarly, you could print the text file poem.txt by typing

        
    % lpr -Pstu poem.txt

This will print the file containing a title (in this case poem.txt), border, and a heading consisting of your login name.

To print the same file in single sided mode without your login name, append .sgl to the end of the printer name:

        
    % lpr -Pstu.sgl poem.txt

Similarly, appending .dup will print out the file using both sides of the paper without your login name being displayed:

        
    % lpr -Pstu.dup poem.txt

If you want some other layout, you will have to convert the text file to postscript yourself. You can do this using the program aps. The general form of this command is:

    aps [flags] textfile

It will print out the text file in postscript format. Given no flags, the postscript will be exactly as it would if you send the text straight to the printer, but in portrait. aps puts its output on the standard output, so you will probably want to redirect it to a file, or straight to the lpr command.

Here are some examples of how you could print the file poem.txt on the student laser printer:

    % aps poem.txt | lpr -Pstu
    
    % aps poem.txt > poem.ps; lpr -Pstu poem.ps

To print a text file with no border or header in portrait form you can use:

    aps -~B -P -~H file.txt | lpr -Pstu

Here, the `~' option is used to turn off the border (B) and header (H). For more information on file printing and viewing, refer to section 2.3.6 on page [*].

Loc Van Huynh 2007-03-15
Top Of Page

 ###
Site maintained by webmistress@cse.unsw.edu.au
Please read the UNSW Copyright & Disclaimer Statement