How to open a PDF file from terminal?

Most desktop environments (generic)

xdg-open file2open.xxx    

GNOME (generic)

  • until Xenial (16.04):

    gvfs-open file2open.xxx
    
  • starting with Artful (17.10):

    gio open file2open.xxx
    

(xxx = some file extension). With this command the default app for xxx will be invoked (for example evince if you want to open PDF).

Application-specific

  • Using Evince, GNOME’s default document viewer:

    evince file2open.pdf
    
  • Using Okular, KDE’s default document viwer:

    okular file2open.pdf
    

You can also use:

xdg-open foo.pdf

xdg-open works in Gnome, KDE, xfce, LXDE and perhaps on other desktops.

You can put an alias in your ~/.bash_aliases:

alias open=xdg-open

For all those lost Mac users in Ubuntu-land ..

Edit your .bashrc file, and add:

alias open='gnome-open'

Then you can just use:

open file2open.pdf