Recently I found out a new very useful command. It is:




or just


on mac.

It opens file or directory in by default specified program.

But, in the event that I need to open a file in an already running redactor (I mean send the file to a running processes somehow) I have no solution. I wonder if there is any way to achieve that or if it is possible to write a script that can do that.

For example if I want to send it to an already running instance of eclipse.

Kind of drag-and-drop through commandline.

4 Answers 4


Did you try

eclipse --launcher.openFile <absolute path of file to open>

Eclipse OpenFile Feature.

  • 1
    Yep.. already tried. it is trying to open in new instance of eclipse. But from the link that you provided it has to open it in running instance. I'm using ubuntu and eclipse Version: 3.5.2. Perhaps i need to upgrade the version of eclipse?
    – Pol
    Commented Apr 24, 2011 at 2:31

This kind of control is program specific. Different editors will support it in different ways or won't support it at all. For example, Eclipse uses the command mentioned by Mikel. Vim or GVim, which is my preferred editor supports a sophisticated mechanism for remote control beyond simply opening a file in an existing Window. To simply load a file into an existing session:

gvim --remote file1.c file2.c

It will also start an existing session if it can't find an existing one. You can also name specific GVim windows to target them and do remote scripting of existing GVim windows. I'm sure Emacs has similar functionality.


Most programs that accept new file or other object input will have a separate binary to talk to the main one, usually known as a remote. I don't know about eclipse, but for example gimp-remote allows you to open new images in the already running application.


I tried your said "gnome-open" command from command-line, And It opens the underlying file in an associated application.

e.g. I execute the command "gnome-open /etc/X11/xorg.conf", it opens in gedit.

And the from command-line, I again the execute the command, "gnome-open /etc/passwd". Now this file is also get opened in the same instance of gedit.

So I guess, this is what you are looking for.

You have to use "gnome-open" command only.

  • With gedit it works fine. But I wanted to send it to eclipse.
    – Pol
    Commented Apr 28, 2011 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .