How to print a plain text file to printers from a terminal in Linux
Posted on In QAHow to quickly print a plain text file to printers from a terminal in Linux?
You can also use enscript:
enscript – convert text files to PostScript, HTML, RTF, ANSI, and overstrikes
https://www.systutorials.com/docs/linux/man/1-enscript/
enscript text-file
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.