How to open a pdf file from terminal.

This is perhaps the most asked and searched questions by people using FOSS software and the one’s who breathe inside the terminal. Well your mileage might vary depending on which Operating System you’re on and the Desktop Environment(DE), etc. But the question here is how to open a pdf file from terminal; so let us begin !

In most certain Desktop Environments, including Ubuntu’s Unity and after 18.04 LTS, Gnome 3.X you can use:

 

xdg-open filetoopen.xxx

 

In Gnome, you also can use:
gvfs-open filetoopen.xxx

 

(xxx = some file extension). With this command the default app for “xxx” will be invoked (for example document viewer in Ubuntu’s Unity DE, if you want to open pdf).

 

Or specifically:

 

evince filetoopen.pdf

 

Or (default for KDE):
okular file2open.pdf

 

That’s it, you’re work is done !
Akash Angle

I am a Full time Linux user who has quit using Windows for unknown reasons, making my life truly open source.

Recent Posts

Get the most juice from your ISP/router — setting MTU size & other handy tweaks

This is not an ad-vocation by any means for TP-link branding, however a real life…

5 months ago

How to make any Android phone up-to 3x faster – Developer options unleashed

First of all we need to hit the kernel version on any Android device. You…

5 months ago

systemd-resolve command not found in Ubuntu Desktop

Use resolvectl status instead. It's like something deprecates and suddenly things get broken! In systemd…

10 months ago

How to exclude multiple directories with rsync?

Geeky question: This is what people and friends have tried: rsync -arv --exclude "/home/john/.ccache:/home/ben/build" /home/john…

10 months ago

How to resolve apt-get -f not working

You might encounter this error which appears to be very common on Debian based Distro's…

10 months ago

How to install Broadcom STA wireless drivers on Kali Linux

PS: This article is for only Kali Linux users, that too having a Broadcom Wireless…

10 months ago