How to open a PDF file in Ubuntu using terminal? [duplicate]

I'm using this command: gnome-open file_name.xxx (xxx file extension) command but it's not working. I'm using Ubuntu 14.04.

38.5k 14 14 gold badges 108 108 silver badges 156 156 bronze badges asked Mar 8, 2016 at 9:15 2,661 7 7 gold badges 27 27 silver badges 45 45 bronze badges

1 Answer 1

You could either try xdg-open (xdg-open - opens a file or URL in the user's preferred application):

xdg-open /path/to/file.pdf 

Or you directly launch Evince, the default Ubuntu document viewer, and open the file with it:

evince /path/to/file.pdf 

Note that you must always quote path names with special characters like spaces or colons - or escape each of those characters using a backslash:

xdg-open '/path/with:some/special characters/strange filename.pdf' xdg-open "/path/with:some/special characters/strange filename.pdf" xdg-open /path/with\:some/special\ characters/strange\ filename.pdf' evince '/path/with:some/special characters/strange filename.pdf' evince "/path/with:some/special characters/strange filename.pdf" evince /path/with\:some/special\ characters/strange\ filename.pdf' 

You may chose the variant you prefer.