Linux Know-How provides a collection of introductory texts on often needed Linux skills.


Printer Setup

Start an X-terminal (perhaps by pressing the proper button) and type in it (as root or you will be prompted for the root password):

printtool &

This program does a complete printer setup, you just have to fill up the information about your type of printer and where it is hooked up.

Specifying the proper printer port is the most important part. If you don't know which one is yours try: on RedHat 5.2: lp1 (this is the first parallel port on RH5.2 ) or lp2 (this is the second parallel port on RH5.2) or lp3 (this is the third parallel port on RH5.2); on RedHat 6.0 (or later): lp0 (this is the first parallel port on RH6.x) or lp1 (this is the second parallel port on RH6.x) or lp2 (this is the third parallel port on RH6.x). After upgrading from RH5.2 to 6.0, the printing stopped working because the name of the parallel ports changed. I had to re-run the printool and adjust the port. The numbering of ports changed to bring it in line with numbering of other devices, which always starts from 0.

Try printing an ASCII test-page straight to the port. Only when this works set up the bells and whistles.

If you are setting up a remote printer, make sure that your machine has the permission to use the remote printer. The permissions are set in the file /etc/hosts.lpd (more secure) or /etc/hosts.equiv (less secure) on the machine to which the printer is attached. These files simply list the names of the remote computers that can use a local printer, one computer name per line. Mine looks like this:

hacker

mars

The file /etc/hosts.lpd did not exist on my system, so I created it.

For quick information about the printers on your machine, you may want to view the file /etc/printcap :

cd /etc/

cat printcap

Here is the meaning of some codes that I see in my /etc/printcap:

:

Field separator (separates the entries in the file).

\

(at the end of line) Continuation on the next line.

lp

Name of the printer. "lp" is the name of the default printer on your machine. Subsequent printers are often, by default, given the the names lp0 or lp1, ... (or whatever you like) but this should not be confused with the name of the devices (parallel ports) to which they are connected.

sd=/var/spool/lpd/lp

My spool directory (sd).

mx#0

Maximum size of print jobs (mx) in blocks. "0" means no limit.

sh

I want headers to be suppressed (sh). Header is the page with your name that prints before your printing job (waste of paper if you print at home).

rm=mars

Name of the remote machine (rm), which on my system is called "mars (my printer is connected to a different computer).

rp=lp

or

lp=/dev/lp0

Name of the remote printer (rp), which is the name of the printer on the remote machine ("lp" on "mars" on my home network)
or

the name of the device on the local machine. "/dev/lp0" is the first parallel port on RH6.x (it used to be /dev/lp1 on RH5.2, the numbering of parallel ports changed).

if=/var/spool/lpd/lp/filter

Input filter (if). Your printing job will be formatted by this "filter" before it is sent to the printer.

sf

Suppress the form feed (sf) that is normally sent when printing is completed (use it if your printer keeps printing an empty page at the end of each jobs).

The printer is controlled using the command lpc (as root). Type "?" to see the options. This program is notorious for its peculiarities, so don't get discouraged easily. The printer queue can be viewed with lpq and cleaned up with lprm , both of which work for a user (not only root). You can print from the command line using the command lpr. Under KDE, you can control the printer queue from the program available under the "K-button"-"Utilities"-"Printer Queue".

Most printers will work perfectly under Linux, but some may not utilize their full capability due to lack of information/drivers from the vendors. Therefore, when purchasing a new printer, you may want to consult the database of Linux printers: http://www.linuxprinting.org/database.html. In brief, it is a good bet is to select ( http://www.linuxprinting.org/suggested.html):

  • For inexpensive colour printing: an Epson Stylus, for example: Stylus C80 (better) or Stylus C60 (cheaper) (Dec.2001). HP inkjets are generally less recommended than Epson's. Please note that "inkjet-type" printers are (in general) "not-so-great" for black-and-white printing. Also, they are meant to be "personal" printers and do not handle well high volumes. Yet they can offer excellent colour output, particularly on good quality paper. Kids love inkjets.

  • For low-end laser printing: a Lexmark or Brother printer. Many Hewlett-Packard (HP) laser printers will also work perfectly, but one has to be more careful when selecting an HP printer due to their more limited support. Lower-cost laser printers are always black-and-white, but they offer excellent quality text printouts. You may avoid some headaches if you select a printer which supports "Postscript".


Last Update: 2010-12-16