Linux Printing
When working on one of the Sociology computational servers (charisma or paradigm) or the login server (login), printing is done to one of the department network printers.
Three general purpose laser printers and the Ricoh copier are available for Linux printing, as indicated in the table below. Output is sent to a specific printer by directing it to the queue associated with that printer.
Department of Sociology Network Printers |
|||
Printer |
Location |
Details |
Linux Print Queue Name |
HP LaserJet P3015X |
Room 140 Hallway |
1st Floor - 42ppm, duplex, PostScript |
lab |
HP LaserJet P3015X |
Room 268 Hallway |
2nd Floor - 42ppm, duplex, PostScript |
copy2 [default] |
HP LaserJet P3015X |
Room 330MR |
3rd Floor - 42ppm, duplex, PostScript |
copy3 |
Ricoh MP C6004 Copier |
Room 268 Hallway |
Departmental copier & high volume printer - 60ppm, duplex, hole punch, staple, collate |
ricoh |
Common printing tasks include:
- Statistical output printed from interactive programming sessions
Files printed with lpr and enscript commands
- Email messages printed from the Pine email program
0.1. The Default Print Queue
The default Linux print queue is copy2, which directs output to the LaserJet P4015tn printer located in the second floor copy room. You can set a personal default with the lpoptions command, which writes a setting to the .lpoptions file located in your home directory. The example below sets a personal default to the lab print queue.
$ lpoptions -d lab
0.2. Printing with the lpr Command
The lpr (line printer requester) command is used to send output to the default or to a designated print queue. Commonly lpr receives a specified file as input, but can also accept standard input piped to it from another command. The following examples clarify:
- Send a text file to the default print queue:
$ lpr note.txt
Send a text file to a designated print queue by including the -P argument with the queue name:
$ lpr -Plab note.txt
Prepare a PostScript formatted manual page for the Linux cat command and pipe it as input to lpr for a printed copy. This technique will produce printed documentation for any Linux command with an existing manual page.
$ man -t cat | lpr
The lpr command sends output without altering it. If the file is text, then text is printed. Graphical and PostScript files are handed off as such, leaving the task of formatting them to the printer.
0.3. Printing with the enscript Command
The enscript command is used to convert text into PostScript formatted output, which is then directed to a print queue. This allows for labelling, indentation, font control, landscape printing, multi-column printing, duplex printing and other variations that add to the flexibility and convenience of output preparation. Output from interactive Linux SAS sessions, for example, prints using enscript landscape, 2-column printing. The following table illustrates typical uses of enscript.
Command |
Description |
$ enscript note.txt |
Direct named file to the default queue. Each page of output will have a bold header containing the filename, the date, the time and a page number |
$ enscript -Pcopy3 note.txt |
Direct named file to the copy3 print queue |
$ enscript -DDuplex:true note.txt |
Print the named file in duplex mode |
$ enscript -n2 note.txt |
Direct that two copies of the named file be printed |
$ enscript -i8 note.txt |
Print the named file with left indentation 8 characters more than normal |
$ enscript -G note.txt |
Print the named file with fancy headers |
$ enscript -B note.txt |
Print the named file without headers |
$ enscript -r note.txt |
Print the named file in landscape mode |
$ enscript -2r note.txt |
Print the named file in landscape mode with two columns per page |
$ enscript -2rG -Plab note.txt |
Direct the named file with fancy headers in landscape, 2-column mode to the lab print queue |
$ enscript -2rG logit.log logit.lst |
Print multiple files with one enscript command [i.e.; a set of SAS program and output logs] |
$ enscript -fTimes-Roman9 note.txt |
Print the named file using Times-Roman, 9-point font |
$ enscript -a 4-7 codebook.txt |
Print pages 4-7 of the named file |
$ enscript -a -9 codebook.txt |
Print the first through 9th pages of the named file |
$ enscript -a 6- codebook.txt |
Print the 6th through the last pages of the named file |
$ enscript -a odd codebook.txt |
Print the odd pages of the named file |
$ enscript -a even codebook.txt |
Print the even pages of the named file |
The default font for portrait printing is Courier 10 point (a mono-spaced font where each character occupies the same amount of space). The default for landscape, two column (-2r) printing is Courier 7 point.
You may combine several of the above options to produce highly tailored printing effects. For a full discussion of enscript, see the enscript man page.