Change Default File Browser Directory

From UCSC Genomics Institute Computing Infrastructure Information

When starting a notebook, by default, the "File Browser" directory on the left panel of the Jupyter Notebook window in your home directory. If you would prefer to have that default directory be something else, follow these steps.

Stop All Current Running Notebooks

Stop all your notebooks before proceeding. In this case, click "File" -> "Hub Control Panel", then click the red "Stop Server" button.

Create User Jupyter Config File

Create a custom Jupyter config file by ssh'ing over to mustard.prism and then doing:

jupyter server --generate-config

It will create a directory in your home directory called .jupyter. There is a file in that directory called:

jupyter_server_config.py

We need to edit that file, and add a line to the top of the file. The line we add will direct the Jupyter Notebook to use a different root directory when spawning, often a groups directory like /private/groups/hausslerlab as an example. Open the file using vim or whatever your favorite text editor is:

vim ~/.jupyter/jupyter_server_config.py

Add this line to the top of that file:

c.ServerApp.root_dir = '/private/groups/hausslerlab'

/private/groups/hausslerlab should be changed to whatever you want your default directory to be.

Launch a New Notebook Instance

Launch a new cluster notebook instance, and you should see your new default directory on the left!

OPTIONAL: Symlinks in your Home Directory

There is another way to do this that doesn't involve creating a config file and editing it. Simply add a symlink in your home directory to your lab's groups directory, and you can click on that in the file browser and it will take you to your lab directory.

cd ~
ln -s /private/groups/hausslerlab hausslerlab

Again, /private/groups/hausslerlab should be wherever you want the link to take you.