How can I change the working directory in Jupyter?

To change the working directory of Jupyter, you can follow these steps:

  1. Open a Jupyter Notebook.
  2. In the main interface of Jupyter Notebook, click on the “New” button in the top right corner, and then select the “Terminal” option. This will open a terminal window.
  3. Type the following command in the terminal window to view the current working directory:
pwd
  1. To change the directory, use the cd command. For instance, to change the working directory to “/Users/username/Documents”, you can input the following command:
cd /Users/username/Documents
  1. Use the “pwd” command to confirm that the new working directory has been set to the directory you selected.
  2. Close the terminal window.
  3. Restart Jupyter Notebook. You will be running Jupyter Notebook in a new working directory, where the files in that directory will be visible in Jupyter.

Please note that changing the working directory will only affect the current open Jupyter Notebook session. If you want to permanently change Jupyter’s default working directory, you can edit Jupyter’s configuration file. Specific steps on how to do this can be found in Jupyter’s official documentation.

bannerAds