Jupyter Notebook: Navigating Directories using the Browser and Terminal
Jupyter Notebook is a powerful tool for data analysis and visualization. One of the essential skills when working with Jupyter Notebook is navigating directories. This article will cover how to navigate directories using the browser and terminal levels in Jupyter Notebook.
Navigating Directories using the Browser
Jupyter Notebook has an in-browser file explorer that allows you to navigate directories. To access the file explorer, click on the "Files" tab on the Jupyter Notebook homepage.
The file explorer displays the directories and files in the current working directory. To navigate to a different directory, double-click on the directory name. To go up one directory level, click on the "up" arrow located at the top of the file explorer.
Navigating Directories using the Terminal
Jupyter Notebook also provides a terminal that allows you to navigate directories using command-line instructions. To access the terminal, click on the "Terminal" tab on the Jupyter Notebook homepage.
Once you are in the terminal, you can navigate directories using the following commands:
pwd: displays the current working directoryls: lists the directories and files in the current working directorycd: changes the current working directory to the specified directory cd ..: goes up one directory level
Copying a Long Path from the Terminal
If you need to copy a long path from the terminal, you can use the following method:
- Right-click on the terminal window and select "Select All"
- Right-click again and select "Copy"
- Open a text editor and paste the copied text
- Manually select the desired directory path and copy it
Pasting the Copied Path Somewhere
Once you have copied the desired directory path, you can paste it in the following ways:
- In the file explorer: click on the "path" input box at the top of the file explorer and paste the copied path
- In the terminal: type
cdfollowed by a space and then paste the copied path
Navigating directories in Jupyter Notebook is an essential skill for data analysis and visualization. This article covered how to navigate directories using the browser and terminal levels in Jupyter Notebook. It also covered how to copy a long path from the terminal and paste it in the file explorer or terminal.
References
```python
# Example code block
import os
# Display the current working directory
print(os.getcwd())
# List the directories and files in the current working directory
print(os.listdir())
# Change the current working directory
os.chdir('/path/to/directory')
# Display the current working directory
print(os.getcwd())
```