How to Open PDFs in Linux Terminal (No GUI Needed)

If you click our links and make a purchase, we may earn an affiliate commission. Learn more

PDFs are a widely used document format; chances are you already have several on your computer. But have you ever wondered how to open a PDF directly from the terminal? In this tutorial, I’ll show you exactly how to do that, step by step.

Several tools can be used to open PDFs from the terminal. Options like Evince and Zathura are designed for Linux systems with a Desktop Environment. At the same time, tools like Jfbview, Green, and Pdftotext are suitable for systems without a graphical interface, such as servers.

I’ll start by covering the tools specifically supported on systems with a Desktop Environment. After that, I’ll introduce the tools designed for systems without a graphical interface. It’s worth noting that these non-graphical tools can also function on systems with a graphical environment.

If you need help with Linux, I’ve got something that can help you right away!
Download my free Linux commands cheat sheet – it’s a quick reference guide with all the essential commands you’ll need to get things done on your system. Click here to get it for free!

Open PDFs with a Desktop Environment

It’s a common myth that Linux doesn’t have software support for things like PDFs. If you have a desktop environment, things are pretty straightforward and many tools are available. I’ll focus on a few that I’ve found reliable, easy to install, and often come pre-installed on your system.

Evince

Evince is a popular document viewer that comes pre-installed on many Linux distributions, especially those using the GNOME desktop environment.

In the applications menu, it is typically listed as “Document Viewer,” so don’t be surprised if you don’t see the name “Evince” explicitly mentioned.

If Evince is not installed, you can add it using your package manager. For example, on Ubuntu:
sudo apt install evince

Tip: Command lines can be a pain to memorize. I put the essential Linux commands on a printable cheat sheet so you don't have to keep googling them. You can grab the PDF here if you want to save some time.

Always Forgetting Linux Commands?
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.

Download now

To open a PDF with Evince from the graphical interface, right-click on the document and select “Open with Document Viewer,” as shown below.

But you probably already knew that. Now, let’s focus on the main part of this tutorial: how to open a PDF with Evince from the terminal. Follow the steps below:

Prefer reading without ads and popups?
Members get an ad-free version of every guide, plus exclusive project support.
Join the Community | Sign In
  • Launch the terminal and navigate to the directory where you have the PDF file.
    If you are new to Linux, you can read this post on useful Linux commands you need to know (Cheat Sheet).
  • Use the evince command to open the PDF as shown below:
    evince sample_one.pdf
    Remember to replace “pdf_name” accordingly.
    This command will open the PDF using “Document Viewer.”

Zathura

Zathura is another utility that opens PDF files from a terminal. Unlike Evince, Zathura doesn’t come pre-installed on most Linux distributions, but it can be easily installed using the package manager.

To install Zathura, along with PDF support, you can use the following command on Ubuntu:
sudo apt install zathura zathura-pdf-poppler

Zathura is known for its minimalistic design and keyboard-driven interface, making it a great choice for users who prefer a lightweight document viewer.

Once installed, you can open a PDF from the terminal by typing:
zathura sample_one.pdf

Zathura is a keyboard-centric application, so once the PDF is open, you can navigate using keyboard shortcuts like j and k to scroll, and + and to zoom in and out.

LibreOffice

LibreOffice is a free and open-source office suite that provides various productivity tools, similar to Microsoft Office.

Always Forgetting Linux Commands?
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.

Download now

You’ve likely encountered LibreOffice while using Linux, as it comes pre-installed on many distributions. But have you ever tried using LibreOffice to open a PDF?

LibreOffice comes with an app called LibreOffice Draw. Not only does this app allow you to open PDFs, but you can also use it to edit them. Therefore, you don’t need to look for commercial third-party solutions to manipulate your PDFs.

Follow the steps below to open a PDF with LibreOffice Draw from the terminal.

  • Launch the terminal and navigate to the directory where you have the PDF file.
  • Use the command below to open the PDF:
    libreoffice --draw sample_one.pdf
    Alternatively, you don’t have to type the whole name “LibreOffice,” you can use the shortcut below:
    loffice --draw sample_one.pdf

Open PDFs on Linux Servers: Best CLI Tools

I’ve already shown you how to open PDFs on systems with a Desktop Environment. Now, let’s explore how to open PDFs directly in the terminal, where the PDF contents are displayed right in the terminal window.

This is especially useful if you’re working on a system with only CLI access, such as a server or a minimal Linux installation.

Note: These methods can also be used on a Desktop system.

PdfToText

PdfToText is a lightweight and powerful command-line tool that extracts text from PDF files, making it a great option for viewing PDF content directly in the terminal.

Always Forgetting Linux Commands?
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.

Download now

Unlike graphical viewers, PdfToText converts the PDF into plain text, which is then displayed on your terminal.

This utility comes pre-installed on most systems. However, if that is not the case for you, use the commands below to install it according to the distribution you are running.

  • On Ubuntu/Debian-based systems:
    sudo apt install poppler-utils
  • On RHEL-based systems:
    sudo dnf install poppler-utils
  • On Arch-based systems:
    sudo pacman -S poppler

Once installed, follow the steps below to use PdfToText to open a PDF from the command line.

  • Use the cd command to navigate to the location where you have the PDF file.
  • Open the PDF using PdfToText using the command syntax below:
    pdftotext sample_pdf.pdf
    Remember to replace the “sample_pdf” name accordingly and take note of the “hyphen” sign at the end of the command.

Less

Another tool used to view PDFs from the terminal is the Less command-line utility.

Even though this utility is quite popular with editing text files, it can also be used to view text files in a paginated manner, allowing you to scroll through the content easily.

One thing to note is that the Less utility typically relies on the PdfToText utility, which converts PDFs to plain text.

Use the command syntax below to open a PDF with the ‘Less’ utility from the terminal:
less sample_pdf.pdf

Green

Green is another tool you can use to view PDFs from the terminal, and it offers a unique experience.

Always Forgetting Linux Commands?
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.

Download now

Unlike Less and PdfToText, which display PDF content as plain text, Green renders PDF documents in a more visually appealing format, maintaining the layout and formatting of the original file.

Green uses the framebuffer to display graphics directly in the terminal. This means it shows PDF documents in a way that looks much better than plain text viewers, keeping the layout and formatting intact.

Follow the steps below to install Green and use it to open PDFs on the terminal:

  • The first thing is to clone the Green repository using the command below:
    git clone https://github.com/schandinat/green.git
  • Next, install several dependencies necessary for successfully installing Green on your system:
    sudo apt install libpoppler-glib-dev libsdl1.2-dev
  • Use the cd command to navigate into the Green directory and use the command below to compile the source code:
    make
  • If everything executes smoothly without throwing any errors, use the command below to install Green on your system:
    sudo make install

After a successful installation, you can use Green to open a PDF using the command syntax below:
green sample_pdf.pdf

As you can see above, Green displays the PDF the way you would see it on a graphical interface.


🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Want to connect with other Raspberry Pi fans? Join the RaspberryTips Community. Ask questions, share your projects, and learn from each other. Join now.

FAQ

How do framebuffer tools work for viewing PDFs?

Framebuffer tools allow you to view PDFs in the terminal by rendering the content directly to the screen without a graphical interface.

Instead of relying on a desktop environment, they render the PDF visually by interacting with the system’s low-level graphics system (the framebuffer).

Are there other tools for viewing PDFs from the command line?

Yes, there are other tools that you can use but their installation processes can be challenging due to outdated repositories on current Linux systems. The tools listed below utilize FrameBuffer to render PDF content directly in a terminal like Green.

Is it possible to view PDFs remotely over SSH?

Yes and No. Tools like ‘Green,’ ‘Jbview’ or ‘Fbpdf’ that use framebuffer cannot display PDFs over SSH because they require direct access to the display. However, command-line tools like ‘Less’ and ‘PdfToText’ can extract and view PDF content in the terminal.

Whenever you're ready, here are other ways I can help you:

Master Linux Commands: Overwhelmed with Linux commands? This book is your essential guide to mastering the terminal. It includes practical tips, real-world examples, and a bonus cheat sheet to keep by your side.

The RaspberryTips Community: Need help with Linux or want to chat with people who actually get it? Join the RaspberryTips Community and get access to private forums, exclusive lessons, and direct support.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts