-
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 -
As
root, create /etc/printcap with these contents:lp:\ :lp=/dev/unlpt0:\ (1) :sh:\ :mx#0:\ :sd=/var/spool/lpd/lp:\ :lf=/var/log/lpd-errs:
1 This line is for a printer connected to a USBport.For a printer connected to a parallel or "printer" port, use:
:lp=/dev/lpt0:\
For a printer connected directly to a network, use:
:lp=:rm=network-printer-name:rp=raw:\
Replace network-printer-name with the
DNShost name of the network printer. -
Enable LPD by editing /etc/rc.conf , adding this line:
lpd_enable="YES"
Start the service:
# service lpd start Starting lpd. -
Print a test:
# printf "1. This printer can print.\n2. This is the second line.\n" | lprIf both lines do not start at the left border, but "stairstep" instead, see 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 intolpr.% lpr textfile.txt % ls -lh | lpr