Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 am using Linux, and I would like to be able to programmatically open notebooks in a running Mathematica instance from the command line. Currently, doing something like

/opt/Wolfram/Mathematica/8.0/Executables/Mathematica foo.nb

launches a new kernel/frontend instance. Is it possible to re-use a running frontend for opening notebooks (short of enforcing single-instance behavior, for which I believe there is a command line option)?

share|improve this question
up vote 14 down vote accepted

You can start Mathematica with :

/opt/Wolfram/Mathematica/8.0/Executables/Mathematica -sl &

and then open your notebook in the same session with :

/opt/Wolfram/Mathematica/8.0/Executables/Mathematica -sl foo.nb

From the man page Mathematica --help :

-sl (--singlelaunch): Open in an existing process, if possible.

share|improve this answer
Yes, the -sl flag does the trick. Another instance of Mathematica can still be launched by omitting the flag; opening notebooks afterwards with the -sl flag will still be bringing them up in the first instance – Leo Alekseyev Oct 27 '12 at 20:19
It seems it's very important that the first instance is also started with -sl. – Szabolcs Jul 17 '15 at 8:51

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.