Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

Did you try

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

Eclipse OpenFile Feature.

share|improve this answer
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 Apr 24 '11 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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
With gedit it works fine. But I wanted to send it to eclipse. – Pol Apr 28 '11 at 15:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.