Launch files / directories using Gnome from command line

4

1

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.

Tadmas

Posted 2009-10-16T11:51:02.983

Reputation: 165

Answers

4

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

Kyle Brandt

Posted 2009-10-16T11:51:02.983

Reputation: 3 089

Gah! It's so obvious when you know the answer. Thanks! – Tadmas – 2009-10-16T12:07:44.993

6

A cross-distribution, cross-desktop manager command to achieve this is:

xdg-open foo.bar

innaM

Posted 2009-10-16T11:51:02.983

Reputation: 9 208

0

 nautilus .

I use it all the time! Works for folders, only.

Lakshman Prasad

Posted 2009-10-16T11:51:02.983

Reputation: 2 245

0

There is also see and edit:

  # opens PDF viewer
  see file.pdf

  # Opens text editor
  edit file.txt

This is part of the mime-support package.

daniel kullmann

Posted 2009-10-16T11:51:02.983

Reputation: 585