How do I start jupyter notebook from command-line to run in my current directory, without editing config files or passing hard paths?

smci picture smci · Dec 19, 2017 · Viewed 15.8k times · Source

Juypter notebook currently has a limitation: Starting terminal in current directory

How do I do this from command-line (no Anaconda or other GUI), without the following unacceptable hacky approaches? (and in particular where the notebook directory might well change between invocations, or between users?)

  1. Manually edit the hard path into your jupyter notebook config file, in the c.NotebookApp.notebook_dir parameter

  2. Embed hard paths into your notebook code. Must be absolute paths. (yukky). Also user-dependent. Can't distribute notebooks which handle files properly with paths relative to their install dir. Or across machines.

Answer

smci picture smci · Dec 19, 2017

Best solution found so far (on Unix):

jupyter notebook --notebook-dir  `pwd` &

because

jupyter notebook --notebook-dir  . &

(relative-paths) won't work for commands from inside the notebook.