You are in: home » programming » article

Bash: how to avoid multiple instances of a program like VLC

Tags: linux bash vlc

If associate multimedia files to VLC media player, you can find quite irritating that every time you want to watch a video, a new window opens, i.e. a new instance of VLC is created.
To avoid this, you can write a simple bash script that forces any existing instance of VLC to quit and opens a new one. Then you can associate the script with multimedia files.
Let's call this script onevlc:

#!/bin/bash
killall vlc
exec vlc "$@"

Make the script executable, changing its permissions: chmod 755 onevlc.

If you have root privileges, you may place the script in the /usr/bin directory.

referrers Check incoming links to this article, according to Yahoo!.

|

react Send your reaction to this article by email.

|

bookmark Save this article using an online web2.0 service, the bookmark can be priate or can be shared with the rest of the world.

|

print If Javascript is disabled you'll need to use your browser's control to print this pages.