
Linux
Ubuntu: Opening Files with the Default Program From a Terminal
Say you want to open a PDF file (myDocument.pdf) through the terminal of the Ubuntu desktop environment. On Windows you would just type the name of file, and Windows finds the program assigned to the PDF extension. On Ubuntu you can type
evince myDocument.pdf
Where evince is the name of the PDF document viewer on Ubuntu. However, it is easier to use the program that Ubuntu’s desktop environment has assigned to the extension:
xdg-open myDocument.pdf
This way you don’t have to find the name of the appropriate binary.
Note
In older versions of Ubuntu this might not work. The gnome-open command can be used instead.
In older versions of Ubuntu this might not work. The gnome-open command can be used instead.
Hi there,
This is the first page for google search ‘document viewer ubuntu command’. And the command ‘gnome-open’ is an awesome, excellent command. Many thanks for command, much appreciate it.
Glad to hear you found your answer!
Five stars!