Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I've unchecked VLC's option - 'only allow one instance', since it would help simultaneous playbacks. But sometimes it is desirable to just open a new file in the already running one. Is it possible to append a script in nautilus (I don't know how) that will open the file in the already running vlc, instead of changing vlc preference or dragging and dropping methods?

Edit: You guys might already know this, but I just found out that we could put bash scripts at "/home/.gnome2/nautilus-scripts" either in folders or not (to group them). So it's just a matter of finding out the running pid of vlc and force the file to open in it. I don't know bash scripting but if you do, please help me out here.

share|improve this question
According with what is the accepted answer for How to add “Add to VLC playlist” to the right click menu of Nautilus? and with what the OP specified in this question, no these can't be duplicates. – Radu Rădeanu Sep 17 '13 at 15:32
up vote 1 down vote accepted

Your new edit at the question is good pointed. But I'll rephrase.

The submenu Scripts only appears in the right click on a file or directory in Nautilus once you have at least one script in the scripts directory. This script directory should be located in (if you don't have it, you should create it):

  • ~/.local/share/nautilus/scripts - for versions of Nautilus >= 3.6
  • ~/.gnome2/nautilus-scripts - for versions of Nautilus < 3.6

You can check your nautilus version from terminal using nautilus --version command.

Note: Once you place a script in your scripts directory, it's name will not necessarily appear in the scripts menu immediately. You might have to visit the scripts directory with Nautilus - which can be done using the last option in the scripts menu. Once the directory is visited, Nautilus will know about which scripts you have, and you will be able to use them.


These being said, the following script should make the trick about you asked for your VLC:


pid=$(pidof vlc)

## !!! if you want that only the last opened instance of vlc to be replaced 
## in case you have many instances opened, uncomment next line (delete the hash mark from the front)
#pid=$(echo $pid | cut -d ' ' -f1)

if [ "$pid" != " " ]; then
    kill $pid

vlc "$@"
share|improve this answer
Not only is this a perfect solution here, but it might apply to all those other questions of similar context! Thank you very much. – Python Student Sep 17 '13 at 16:00

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.