Printing with Linux

ADDING A PRINTER

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.

PRINTING

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!

Error: Please check your email address.
Rocket to Success - Your 10 Tips for Smarter ERP System Selection
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Rodney Gedda

PC World
Show Comments

Cool Tech

Breitling Superocean Heritage Chronographe 44

Learn more >

SanDisk MicroSDXC™ for Nintendo® Switch™

Learn more >

Toys for Boys

Family Friendly

Panasonic 4K UHD Blu-Ray Player and Full HD Recorder with Netflix - UBT1GL-K

Learn more >

Stocking Stuffer

Razer DeathAdder Expert Ergonomic Gaming Mouse

Learn more >

Christmas Gift Guide

Click for more ›

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

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.

Walid Mikhael

Brother QL-820NWB Professional Label Printer

It’s easy to set up, it’s compact and quiet when printing and to top if off, the print quality is excellent. This is hands down the best printer I’ve used for printing labels.

Ben Ramsden

Sharp PN-40TC1 Huddle Board

Brainstorming, innovation, problem solving, and negotiation have all become much more productive and valuable if people can easily collaborate in real time with minimal friction.

Sarah Ieroianni

Brother QL-820NWB Professional Label Printer

The print quality also does not disappoint, it’s clear, bold, doesn’t smudge and the text is perfectly sized.

Ratchada Dunn

Sharp PN-40TC1 Huddle Board

The Huddle Board’s built in program; Sharp Touch Viewing software allows us to easily manipulate and edit our documents (jpegs and PDFs) all at the same time on the dashboard.

George Khoury

Sharp PN-40TC1 Huddle Board

The biggest perks for me would be that it comes with easy to use and comprehensive programs that make the collaboration process a whole lot more intuitive and organic

Featured Content

Product Launch Showcase

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?