Gnome – Launch Files and Directories from Command Line

command linegnomelinux

On Windows, I can launch an Explorer window from a command line via "start (dirname)". And this will also launch applications associated with a particular file extension, so I can do "start myfile.txt" and it will open the file in the default text editor (e.g. Notepad). Essentially, Windows exposes a way through the command line to perform the same action as a double-click in Explorer.

Does something similar exist for Gnome? I scanned down the list returned by "apropos gnome", "apropos start", and "apropos open", and nothing looked promising. (I'm using Debian Lenny, if that matters.) I know I can open a file browser via "nautilus (dirname)", etc, but I would prefer to use something that uses my file associations.

My eventual goal is to make an alias from "start" to this command since I'm more familiar with the Windows interface.

Best Answer

Use the gnome-open command and it will use the application you have associated with that file type (MIME). For example:

gnome-open foo.pdf
Related Question