IU homeUITS home
What are archived documents?

Unix printing examples

Here are some examples of printing files with various combinations of the lpr, enscript, 2up, dvips, and psduplex commands. Not all utilities are available on all Unix systems; however, enscript, psduplex, and the PSUtils are installed on Steel at Indiana University.

In all examples, replace printername with the defined name of the printer. Also, in examples using the lpr commands, you could use the equivalent lp commands.

  1. Print a text file, one page per sheet, one-sided: lpr -Pprintername -h filename.txt

  2. Print a text file, two pages per sheet, one-sided, gaudy headers, landscape mode: enscript -Pprintername -2rGh filename.txt or: enscript -hl -p- filename.txt | 2up | lpr -Pprintername -h

  3. Print a text file as in step 2, but on both sides of the paper: enscript -lh filename.txt | psduplex | lpr -Pprintername -h or: enscript -hl -p- filename.txt | 2up | psduplex | lpr -Pprintername -h
  4. Print a text file as in step 2, but on both sides of the paper, with you owning the job but getting a header page: enscript -2rG -p- filename.txt | psduplex | lpr -Pprintername

  5. Print as in 2, but with you not owning the job (i.e., can't remove it from the queue), without getting a header page: enscript -2rGh -Pprintername filename.txt

  6. Print a text file on both sides of the paper, with four or eight pages per side of one sheet, saving paper: enscript -hl -p- filename.txt | 4up | psduplex | lpr -Pprintername -h enscript -hl -p- filename.txt | 8up | psduplex | lpr -Pprintername -h

  7. Print a PostScript (PS) file, one page per sheet, one-sided: lpr -Pprintername -h filename.ps

  8. Print a PS file, two pages per sheet, landscape, one-sided: 2up filename.ps | lpr -Pprintername -h

  9. Print a compressed PS file as in step 7: zcat filename.ps.Z | lpr -Pprintername -h

  10. Print a compressed PS file as in step 8: zcat filename.ps.Z | 2up | lpr -Pprintername -h

  11. Print a PS file as in step 7, but double-sided: cat filename.ps | psduplex | lpr -Pprintername -h

  12. Print a PS file as in step 8, but double-sided: 2up filename.ps | psduplex | lpr -Pprintername -h

  13. Produce a PS file from a DVI file: dvips -o outfilename.ps filename.dvi

  14. Print a DVI file one-sided, one page per sheet: dvips -f < filename.dvi | lpr -Pprintername -h

  15. As in step 14, but double-sided: dvips -f < filename.dvi | psduplex | lpr -Pprintername -h

  16. As in step 14, but two pages per sheet: dvips -f < filename.dvi | 2up | lpr -Pprintername -h You can also use 4up or 8up if you want.

  17. As in step 15, but two pages per sheet: dvips -f < filename.dvi | 2up | psduplex | lpr -Pprintername -h

Also see:

This is document abbp in domain all.
Last modified on June 01, 2005.
Please tell us, did you find the answer to your question?