Skip to main content

linux - Opening a notebook from command line in an existing front end instance


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)?




Answer



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.




Comments