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'm trying to get bash to execute two commands simultaneously. I've read a little about job control, &, bg, fg, but the problem is that the command I want to run doesn't run properly in the bg.

Specifically, I'm trying to get two movie files to start running simultaneously in mplayer (to compare the two).

$ mplayer [file1] & mplayer [file2] & 

doesn't work.

share|improve this question
up vote 2 down vote accepted

Have you tried writing a script that performs that performs this kind of task?

Here is a simple one.


mplayer [file1] & 
mplayer [file2] & 
share|improve this answer
ah, this works perfectly. Why is that? – itsnotmyfault Sep 9 '12 at 20:19
Ah, I would not like to spoil things for you, so that is all you are getting: Welcome to the magnificent world of linux! – NlightNFotis Sep 9 '12 at 20:27
@user80555 On a more serious note, this is a script. It is a file that has some command line interpreter commands, that your cli parses and executes on the order given. You can do a bazillion of things with scripts. As a matter of fact scripts are all the rage in linux. If you are interested in learning more, look here – NlightNFotis Sep 9 '12 at 20:29
Ah, please use italics as the first option for emphasizing something instead of jumping directly to bold. :) thanks! – izx Sep 9 '12 at 21:38
@izx Is bold annoying? If it is I shall stop using it. – NlightNFotis Sep 10 '12 at 4:54

You can do that without a script.Run this command:

(mplayer [file1] &);mplayer [file2] &
share|improve this answer
actually, it needs to be $(mplayer [file1] &);(mplayer [file2] &) – itsnotmyfault Sep 9 '12 at 20:58
No,it does not matter if you put the second part inside brackets. – ignite Sep 9 '12 at 21:01

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.