Under ideal circumstances, printing on Linux will just work. This is true whether you're using a USB cable or connecting over a network. Linux detects my HP Envy 4500 automatically and prints over the network without my having to hunt for drivers or type in an IP address.
Depending on what printer you own, your experience may not go so smoothly. Fortunately, Linux comes with a built-in back up plan for when your computer and printer don't communicate automatically. Only when that fails do you have to hunt around for drivers the old-fashioned way, and at that point, you may be in a situation where your hardware doesn't yet run under Linux.
The likelihood of this is increasingly small. Printers aren't the most rapidly evolving form of tech, and Linux comes with support for many common models.
Technical Background
Most common Linux distributions use the Common Unix Printing System (CUPS, for short) to communicate with printers and get the pixels on your screen onto paper. These days Apple runs the project, so you may recognize the experience if you've moved over from Mac OS X. CUPS communicates with local and network printers using the Internet Printing Protocol.
You can typically find a way to manage printers under system settings, but there's also the option of using the web-based interface by typing localhost:631 into your browser.
How Things Should Work
Ideally, printer installation should be automatic and happen in the background. You plug your printer in, you go to print a document, and you see the printer listed as one of the options.
To confirm if a printer was added automatically, go to Settings > Printers. You should see your printer's name appear on the left.
Installing a Driver
When your computer doesn't automatically detect your printer, you will have to go looking for a driver. Specifically, you're looking for a PostScript Printer Description (PPD) file. This is a description of your printer's capabilities and is needed to make yours run.
Fortunately, having to go hunting for one doesn't necessarily mean you're in for a hard time.
Using the Foomatic database
Chances are, your Linux distribution shipped with a database of free software printer drivers known as Footmatic. It's a funny name, the history of which you can read about online.
To search Foomatic for a driver in Ubuntu, for example, go to System Settings > Printers. From there, press the + or Add button. Select your serial port and press Forward. You should then see a screen prompting you to select your printer make and model.
If you don't see your exact model, it may be worth selecting the closest one to see if you get lucky.
Installing a Manufacturer-Supplied PPD
When the Foomatic database doesn't have what you need, your next option is to check your printer manufacturer's website. There you may find the PPD file for CUPS.
Manufacturers may provide other instructions or installation tools to aid you in the process. Brother provides drivers and commands to make its printers work under Linux. HP supplies Linux Imaging and Printing (HPLIP) software.
When that method doesn't work, you can also give the OpenPrinting.org database a shot.
Adding a Network Printer
As with using a USB cable, if you've already configured your printer to connect to your local network, then it should pop up when you search for available printers.
If it doesn't, then it's time to get your hands dirty. The CUPS web interface looks the same regardless of which Linux desktop environment you prefer (it also works in Raspbian), so let's head there.
In the CUPS web interface, click Adding Printers and Classes or the Administration tab at the top.
Then click Add Printer. CUPS will prompt you for root access.
The next page will list the printers you've already configured for your computer, other available machines on your network, and options for adding a printer that CUPS could not detect. If you know the IP address of your printer, the most straightforward approach is to go with Internet Printing Protocol. Then enter
ipp://ip_address/printer/printer_name
…changing ip_address and printer_name to the correct values.
Most network-enabled printers let you set the IP address using the built-in control panel, but maybe you don't have that option, or you want to assign address remotely. Either way, you can do so using the DHCP protocol. It sounds complex, but you only need to add the line below to the end of the /etc/dhcpd.conf file, providing your own names or numbers for hostname, mac_address, and ip_address.
host hostname {
hardware ethernet mac_address;
fixed-address ip_address;
}
Make sure the hostname you used is also listed in the /etc/hosts file or registered with your DNS server.
CUPS supports other methods, in case you don't want to go with DCHP.
This process only works if your printer is already connected to your network. If you have an older unit connected via a cable, you can turn it into a wireless machine using a Raspberry Pi.
A Foolproof Backup Plan
Printers don't have the best reputation. They break, they run out of ink all the time, and as the explanation above indicates, setup isn't always easy. But these days there are ways to avoid configuring a printer to work with each of your devices.
HP ePrint-compatible printers provide you with an email address and print out any documents or pictures sent to that address. This works regardless of if you're using a desktop or mobile phone. Yes, you are dependent on HP keeping the service running, you have to trust that they aren't doing anything with your email, and print jobs can take a while to go through. These things aside, it works regardless of if you're using Linux, Windows, FreeBSD, Android, iOS, Ubuntu Touch, or an old version of Maemo still trucking along on a Nokia N900 you couldn't bear to get rid of.
You can get a similar experience if you already have a machine configured to run with Apple AirPrint, Google Cloud Print, and other similar services.
When all else fails, you can always get someone else to print your document for you. And if there's no time for that, you can at least print to PDF and save the document for later.
Printing Complete!
Printers can be a pain. But, perhaps surprisingly, this is one area where your experience might be easier on Linux than you've grown accustomed to elsewhere. Many printers are plug in play. You connect your computer and voila, it prints and scans, no finger crossing required. That the process has come so far is one sign that now might be a great time to migrate your workflow over to Linux.
Sadly, there remains a dark side to using printers on Linux. Have you been there? Have you ever had to manually edit files to get things to work? Have you had a printer that simply wasn't supported at all? Or have your printers always worked great out of the box? Share your stories of success or frustration with us!
Source → How to Set Up Your Wireless and USB Printer in Linux