How to switch directories in Jupyter Notebook
Published on Aug. 22, 2023, 12:16 p.m.
To switch directories in Jupyter Notebook, you can use the %cd
magic command. Here’s an example:
%cd /path/to/new/directory
Replace /path/to/new/directory
with the full path to the directory you want to switch to. Note that you need to use the full path, not a relative path.
You can also use the !cd
command to change the working directory of the shell used by Jupyter Notebook, but this will not change the working directory of the notebook itself. For example:
!cd /path/to/new/directory
This command will change the working directory of the shell, but the notebook will still be in the original directory. To change the working directory of the notebook, you need to use the %cd
magic command as shown above.