Change IPython/Jupyter notebook working directory

When I open a Jupyter notebook (formerly IPython) it defaults to C:\Users\USERNAME.

How can I change this so to another location?


Solution 1:

jupyter notebook --help-all could be of help:

--notebook-dir=<Unicode> (NotebookManager.notebook_dir)
    Default: u'/Users/me/ipynbs'
    The directory to use for notebooks.

For example:

jupyter notebook --notebook-dir=/Users/yourname/folder1/folder2/

You can of course set it in your profiles if needed, you might need to escape backslash in Windows.

Note that this will override whatever path you might have set in a jupyter_notebook_config.py file. (Where you can set a variable c.NotebookApp.notebook_dir that will be your default startup location.)

Solution 2:

%pwd  #look at the current work dir
%cd   #change to the dir you want