How to print a plain text file to printers from a terminal in Linux

How to quickly print a plain text file to printers from a terminal in Linux?

asked Mar 31, 2014 by Eric Z Ma (44,280 points)

2 Answers

 
Best answer

You can also use enscript:

enscript - convert text files to PostScript, HTML, RTF, ANSI, and overstrikes

http://www.pkill.info/linux/man/1-enscript/

enscript text-file
answered Jul 14, 2014 by Eric Z Ma (44,280 points)

The lp command can print a plain text file to a printer.

My favorite command:

cat text-file | lp -o media=a4 -o cpi=12 -o lpi=7.2 -o page-left=48 -o page-right=48 -o page-top=48 -o page-bottom=48

It is better to put the options into a script.

answered Mar 31, 2014 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...