Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

1 Answer 1

up vote 5 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

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.