How to open a PDF file in Ubuntu using terminal?

21,097

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.

Share:
21,097

Related videos on Youtube

alhelal
Author by

alhelal

Updated on September 18, 2022

Comments

  • alhelal
    alhelal over 1 year

    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.

  • alhelal
    alhelal about 8 years
    xdg-open file.pdf is works when file name is single word.How can I do for multiple word.i,e "Java The Complete Reference Ninth Edition.pdf"
  • muru
    muru about 8 years
    @al_helal quote it: xdg-open "Java The Complete Reference Ninth Edition.pdf"