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:




In Gnome, you also can use:


(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 !