PDA

View Full Version : open with default application.. from terminal..



anaconda
December 9th, 2009, 04:34 PM
Is there any command to open a file from terminal with default application.. (like double-clicking in gnome)

eg. to open:
.pdf with evince,
picture with eog (who even knew that the "image viewer":s actual name is eog???)
movie with vlc
.doc with openoffice

etc...

Sometimes the names of the programs can be difficult to remember.

And wouldn't it be cool to just type eg.

open ubuntu.pdf
instead of trying to remember what was the name of the program that opens pdf:s

Is it already possible?

If not, it would be a cool little program for someone to make. :D

alphaniner
December 9th, 2009, 04:38 PM
It would be pretty easy to write a script do do this, but you'd have to create tests and conditionals for each filetype you wanted to support.

PS: 'eog' is short for 'eye of gnome'.

23meg
December 9th, 2009, 04:38 PM
Try
xdg-open path_to_file.

Daisuke_Aramaki
December 9th, 2009, 04:41 PM
Try setting up aliases in your .bashrc or .zshrc for different filetypes. You can just choose the file in your terminal and the program you setup for opening that file in your config will be invoked.

anaconda
December 9th, 2009, 04:46 PM
Try
xdg-open path_to_file.

OMG !!!

It already exists. :D

Thank you. You are a real command line GURU.

----

And I thought I had a really good NEW idea. I think I will make an easier (shorter) alias to that though..