DEV Community

Cover image for How to configure & take print on Linux?
5 Mins Learn
5 Mins Learn

Posted on • Updated on • Originally published at 5minslearn.Medium

How to configure & take print on Linux?

4 Simple Steps to take print on your Linux (Ubuntu) machine

Modern printers manufactured nowadays comes with a compact disk (CD) to install the driver. But, most vendors provide support only for Windows machines. This means, the driver that comes with CD can be installed only on Windows machine.

In this article, let’s explore an easy way to configure a printer on your Linux machine and take a quick print out.

Before getting into the configuration steps, let’s understand about CUPS API.

CUPS API

CUPS stands for Common Unix Printing System

From Source (https://github.com/apple/cups)

CUPS is a standards-based, open source printing system developed by Apple Inc. for macOS® and other UNIX®-like operating systems. CUPS uses the Internet Printing Protocol (“IPP”) and provides System V and Berkeley command-line interfaces, a web interface, and a C API to manage printers and print jobs. It supports printing to both local (parallel, serial, USB) and networked printers, and printers can be shared from one computer to another, even over the Internet!

CUPS was originally developed by Michael R Sweet at Easy Software Products starting in 1997, with the first beta release on May 14, 1999. Apple licensed CUPS for macOS in 2002, and in February 2007 Apple purchased CUPS and hired Michael to continue its development as an open source project.

In December 2019, Michael left Apple to start Lakeside Robotics. In September 2020 he teamed up with the OpenPrinting developers to fork Apple CUPS to continue its development. Today Apple CUPS is the version of CUPS that is provided with macOS® and iOS® while OpenPrinting CUPS is the version of CUPS being further developed by OpenPrinting for all operating systems.

So, CUPS was adopted by more than 99% of the modern printers. Almost all the printers released now supports CUPS API.

We need to install CUPS in our Linux machine. Let’s explore the 4 step process to setup and take print out.

Before proceeding, ensure you turned on your printer and connect it with your computer / laptop via USB

Configure CUPS on Linux Machine

Step 1 — Install CUPS

Install CUPS using a simple command from Snap Store

sudo snap install cups
Enter fullscreen mode Exit fullscreen mode

This command will install the latest stable version of CUPS on your machine

Install CUPS from Snap Store

If you’re a debian based user and don’t wish to install CUPS via Snap store, download the latest CUPS release from https://github.com/apple/cups/releases (*.tar.gz file) and install on your machine

Navigate to http://localhost:631/ on your browser to quickly verify your CUPS installtion. This will land you in home page of CUPS.

CUPS can be configured and monitored using a web interface, which by default is available at http://localhost:631/admin . The web interface can be used to perform all printer management tasks.

CUPS Home Page

Step 2 — Find Available Printers

Find the available printers by running the following command

lpstat -p -d
Enter fullscreen mode Exit fullscreen mode

This command will list the available printers connected with your computer both via USB and Network.

List printers connected with your computer

Step 3 — Setup default Printer

Select the printer you want to set default to and run the following command (In my case it is HLB2000D)

lpoptions -d HLB2000D
Enter fullscreen mode Exit fullscreen mode

This command will set the mentioned printer (HLB2000D) as default printer. All your future print requests will be sent to this printer unless you explicitly mention a different printer.

Set a default printer

All the configuration steps are done. Let’s take a print out

Step 4 — Take a Print

Navigate to the folder (use cd command) where you have your PDF of Image files via terminal and run the following command to take print.

lp sample.pdf
Enter fullscreen mode Exit fullscreen mode

Enter your file name next to lp command to take print of the file. In my case, it’s **sample.pdf **file.

Command to take print

My Print job is done and I got the print of my files.

Print of my file (P. S. Ignore the shadow on the paper)

That’s all. Your laptop is configured with the printer. Use the lp command or print button to take print from next time.

Subscribe to our newsletter to receive more such insightful articles that get delivered straight to your inbox.

Top comments (0)