Putting information on paper is a vital function, despite many attempts to eliminate it. Printing has two basic components. The data must be delivered to the printer, and must be in a form that the printer can understand.
Basic printing can be set up quickly. The printer must be capable of printing plain ASCII text. For printing to other types of files, see Section9.5.3, “Filters”.
Create a directory to store files while they are being printed:
mkdir -p /var/spool/lpd/lp
chown daemon:daemon /var/spool/lpd/lp
chmod 770 /var/spool/lpd/lp
/etc/printcapwith these contents:
/etc/rc.conf, adding this line:
Start the service:
service lpd startStarting lpd.
Print a test:
printf "1. This printer can print.\n2. This is the second line.\n" | lpr
If both lines do not start at the left border, but “stairstep” instead, see Section126.96.36.199, “Preventing Stairstepping on Plain Text Printers”.
Text files can now be printed with
lpr. Give the filename on the command line, or pipe output directly into
ls -lh | lpr