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 PC World newsletter!

Error: Please check your email address.

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Rodney Gedda

PC World
Show Comments

Essentials

Microsoft L5V-00027 Sculpt Ergonomic Keyboard Desktop

Learn more >

Lexar® JumpDrive® S57 USB 3.0 flash drive

Learn more >

Mobile

Lexar® JumpDrive® S45 USB 3.0 flash drive 

Learn more >

Exec

HD Pan/Tilt Wi-Fi Camera with Night Vision NC450

Learn more >

Lexar® Professional 1800x microSDHC™/microSDXC™ UHS-II cards 

Learn more >

Lexar® JumpDrive® C20c USB Type-C flash drive 

Learn more >

Audio-Technica ATH-ANC70 Noise Cancelling Headphones

Learn more >

Budget

Back To Business Guide

Click for more ›

Most Popular Reviews

Latest News Articles

Resources

PCW Evaluation Team

Azadeh Williams

HP OfficeJet Pro 8730

A smarter way to print for busy small business owners, combining speedy printing with scanning and copying, making it easier to produce high quality documents and images at a touch of a button.

Andrew Grant

HP OfficeJet Pro 8730

I've had a multifunction printer in the office going on 10 years now. It was a neat bit of kit back in the day -- print, copy, scan, fax -- when printing over WiFi felt a bit like magic. It’s seen better days though and an upgrade’s well overdue. This HP OfficeJet Pro 8730 looks like it ticks all the same boxes: print, copy, scan, and fax. (Really? Does anyone fax anything any more? I guess it's good to know the facility’s there, just in case.) Printing over WiFi is more-or- less standard these days.

Ed Dawson

HP OfficeJet Pro 8730

As a freelance writer who is always on the go, I like my technology to be both efficient and effective so I can do my job well. The HP OfficeJet Pro 8730 Inkjet Printer ticks all the boxes in terms of form factor, performance and user interface.

Michael Hargreaves

Windows 10 for Business / Dell XPS 13

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre x360

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga 910

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?