1

I am beginning to learn and love ubuntu. Is there any way to open files like .pdf, .jpeg, .odt, .docx etc. using command line?

For instance, I have a pdf named: 9949107741MathFormulas.pdf in the following directory:

jitendra@jitendra:~/Downloads/Math.Formulas.and.Tables.8.Retail$

when I go to above directory type 9949107741MathFormulas.pdf to open it, I get the message:

9949107741MathFormulas.pdf: command not found

Please advise, how can this task be accomplished?

Eric Carvalho
  • 55,453
Jitendra
  • 185

2 Answers2

8

I know you already accepted an answer but I think it will be better if you know that this has been discussed in the past with better answers like this one, which I reproduce right here for you.

xdg-open file.dvi

xdg-open will open any file with its default application. As a bonus, you can close the terminal without killing the application.

Since xdg-open is quite a long name, I put an alias for it in .bashrc:

alias go='xdg-open'

This way you don't need to know what application open this file or another. xdg-open will invoke whatever software is related to the file contents or extension.

Don't forget to give credit to Mihai Capotă for his good answer.

Good luck!

2

You fist need to ask the application to open it. For pdf, you can call "evince".

Example command:

evince example.pdf
Alaa Ali
  • 32,213
xeonix
  • 59