Printing with Linux


If you did not set up your printer during installation or you are adding a new printer, a useful program for doing this "is Red Hat's Printtool. Other distributions have printer configuration tools, however, Printtool is well suited for beginners. This program has a graphical interface and can be used to configure either a local or network printer. For ease of use it is recommended over manually editing the /etc/printcap configuration file. The software that controls the print spooling is the line-printer deamon (lpd), and although there are other programs available for Linux such as PDQ and LPRng, lpd is the most popular.

Before you attempt to add a printer, you should connect it to the computer first. This allows Printtool to detect the printer's location. To use Printtool you will need to be running X Windows and be logged into a terminal as root, then type:

$ printtool

The Linux Print System Manger window will appear and you have the "option to edit, add or delete a printer. Selecting "add" will give you the choice of adding a local, remote Unix, SMB/Windows (Samba) or NetWare printer.

If you chose to add a local printer, Printtool will attempt to detect the location of the printer. Clicking OK once the correct location is detected will reveal the Edit Local Printer window: here you will need to assign a name for the printer, the spool directory (which is usually /var/spool/lpd/printer where printer is the name of your printer, e.g., Epson800), the file limit and the input filter. The input filter is where various printer specifications such as model selection, text or PostScript, printing resolution and paper size are set. Once the new printer is installed, print a test page from the Tests menu. If printing does not work, try restarting lpd or editing the input filter settings.

Printtool will also help you configure a remote (network) printer for your Linux system. Adding a remote printer is much the same as adding a local printer, apart from a few specific configuration parameters. If you intend to add support for a remote Unix printer, you will need to specify the hostname of the computer, which controls the printer as well as the remote queue. Similarly, adding an SMB/Windows printer involves the same information, such as a local name and a TCP/IP hostname. However, you will also need to include the remote printer name, a user name and a password. Finally, you can also add a NetWare printer by specifying the NetWare server name for the printer and the print queue name. To be able to print to a NetWare printer, you must have the package's ncpfs (NetWare NCP file system program) and ipxutils (IPX file transfer protocol utilities) installed.

This month's cover CD includes the necessary programs for printer configuration as well as the Linux Printing HOWTO from the Linux Documentation Project.


When you start your computer, the lpd process begins by reading the /etc/printcap file to see which printers are set up (either locally or over a network) and handle print job requests. If lpd is running and your printer is configured, you can use the offline print (lpr) command to print files. For example:

$ lpr linux.txt

will print the text file "linux.txt". As with most other Linux commands, lpr supports various options or "flags" that can be added for specific purposes. Issuing the command:

$ lpr -P printer2 -#5 linux.txt

will tell "printer2" to print five copies of "linux.txt". The -P option is used to specify which printer to print to and is used when more than one printer is supported by your computer. Also, the -#n option specifies the number of pages to be printed (replace n by the number of pages). See the manual page by typing man lpr at the command prompt for more details about lpr.

Just as lpr can be used to send jobs "to the print queue, the lprm command can be used to remove them. To remove "the current jobs from a particular printer, all a user needs to do is execute:

$ lprm -P printer2

Similarly, a root user can remove all the print jobs for a specific user by issuing:

$ lprm tux

where tux is a username. To remove a specific job you will need to know the job number first, which is determined with the lpq command. Issuing lpq will display a list of the current jobs waiting to be printed. Typing:

$ lpq -l

will also display the job number. Therefore, using lprm, you can remove a specific job by typing:

$ lprm jobnumber

where "jobnumber" is replaced by the number assigned to that job.

Whether you have configured your printer during installation or with a program such as Printtool, printing with Linux is a very useful tool. Particularly useful features include network printing and the ability to control jobs that are in the queue.

Join the newsletter!


Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Rodney Gedda

PC World
Show Comments

Brand Post

Most Popular Reviews

Latest Articles


PCW Evaluation Team

Luke Hill


I need power and lots of it. As a Front End Web developer anything less just won’t cut it which is why the MSI GT75 is an outstanding laptop for me. It’s a sleek and futuristic looking, high quality, beast that has a touch of sci-fi flare about it.

Emily Tyson

MSI GE63 Raider

If you’re looking to invest in your next work horse laptop for work or home use, you can’t go wrong with the MSI GE63.

Laura Johnston

MSI GS65 Stealth Thin

If you can afford the price tag, it is well worth the money. It out performs any other laptop I have tried for gaming, and the transportable design and incredible display also make it ideal for work.

Andrew Teoh

Brother MFC-L9570CDW Multifunction Printer

Touch screen visibility and operation was great and easy to navigate. Each menu and sub-menu was in an understandable order and category

Louise Coady

Brother MFC-L9570CDW Multifunction Printer

The printer was convenient, produced clear and vibrant images and was very easy to use

Edwina Hargreaves

WD My Cloud Home

I would recommend this device for families and small businesses who want one safe place to store all their important digital content and a way to easily share it with friends, family, business partners, or customers.

Featured Content

Product Launch Showcase

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?