Using lp and lpstat:
The command to send a file to the printer in Unix is lp (lpr in some systems). It can be used for both text and binary files (such as images). To print using lp, you need to know the name of the destination printers you can use, that is, what printers the system recognizes (if a printer is not recognized, you may have to configure it manually). To do this, type:
lpstat...In the terminal. This should show some information, including the name of the main printer.
lp -d printer_name filenameThis is the standard format for the lp command. The option -d means the destination printer.
enscript is the Unix command to convert a text file to PostScript automatically. You don't need to know PostScript, just this command and its options. The bare-bones format of the enscript command is:
enscript -o output-file.eps textfileThe filename after -o is the file to send the PostScript code to (the PostScript file). The extension for a PostScript file is .eps.
-f - controls the typeface used when printing the file. The name of the typeface consists of the font name followed by a number for the size, as in Courier10 (the default).
-r - print in landscape format
-R - print in portrait format
-b - controls the heading to put on the file. The default is the filename and the date.
-F - select a font for the header text.
-i - number of characters to indent
-j - print borders around the pages
enscript -r -b "2010 Calendar" -f Monaco9 -i 5 -o calendar.eps calendar.txt
For more information on enscript's options, see the man page.
Printing PostScript files:
lp can be used for a PostScript file just like an ordinary file. It will print the output of the PostScript program, not the code itself.
Some systems (such as Mac OS X) will convert a PostScript file to a PDF when it is opened in the GUI. This makes it possible to print it without using the command line or lp.