# How to navigate to the root directory in linux

**URL:** https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151
**Category:** JupyterLab
**Tags:** how-to, help-wanted
**Created:** [December 29, 2023, 3:16pm UTC](https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151 "2023-12-29T15:16:05Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![j215chic](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@j215chic](https://discourse.jupyter.org/u/j215chic)
#### Post date: [December 29, 2023, 3:16pm UTC](https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151/1 "2023-12-29T15:16:05Z")

</div>

hi all  
jlab noob here running Version 4.0.9

I can’t seem to navigate to the root directory in my jlab. I can only “See”

/home/dave/Desktop/tont\_24/data/  
in the file navigator  
how do I get to /home ?

thanks

---

<div class="post-metadata">

### Author: ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)
#### Post date: [December 29, 2023, 5:47pm UTC](https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151/2 "2023-12-29T17:47:24Z")

</div>

Perhaps [this great answer to ‘How to set default folder in JupyterLab file browser?’](https://stackoverflow.com/a/71128495/8508004) will help you.  
Maybe it is sufficient in your case? I think you’d try appending `?file-browser-path=/home` to the URL in your browser in your case and entering that. (Or `?file-browser-path=%2Fhome`? Yet, I don’t think that is necessary to escape here.)  
**However, I think it has limits though.** I think because it is relative, you cannot get above the starting point using this, it seems.  
For example, I was trying to get the file browser above `home` in a session just now and couldn’t when I can use `%cd` in a notebook to get there to `/` as the working directory for the active notebook just fine and that was two levels above where I started and my attempts to use `file-browser-path` to get above there failed.

---

<div class="post-metadata">

### Author: ![j215chic](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@j215chic](https://discourse.jupyter.org/u/j215chic)
#### Post date: [December 29, 2023, 6:15pm UTC](https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151/3 "2023-12-29T18:15:49Z")

</div>

happy new year to all.  
thank you so much for taking the time to reply and giving me things to look at. Remember I am a NOOB and LOVE the jupyter lab experience ( ux, community, zmq ) BUT this seems to be complex. I haven’t tried any of the approaches yet so bear with me. My environment is simple. I run linux mint and ( right now python/julia moving to mojo) and house jupyter labs in a python 3.10 venv.  
I was hoping that the UX would allow me to navigate my whole linux filesystem so I am confused as to why I can’t? If you answered that then I apologize. I don’t use conda and don’t plan to.

---

<div class="post-metadata">

### Author: ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)
#### Post date: [December 29, 2023, 6:32pm UTC](https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151/4 "2023-12-29T18:32:24Z")

</div>

Okay. Different idea…

> [@j215chic](#):
>
> I can only “See”
> 
> /home/dave/Desktop/tont\_24/data/  
> in the file navigator

I’m trying to understand if you know that is where it is in your machine’s hierarchy or is that what the file navigator displays in JupyterLab?  
**If it is what it displays in Jupyter** , try clicking or double clicking on the other words and symbols in the upper right of the file navigator and see if you can go up?

---

<div class="post-metadata">

### Author: ![j215chic](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@j215chic](https://discourse.jupyter.org/u/j215chic)
#### Post date: [December 29, 2023, 7:09pm UTC](https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151/5 "2023-12-29T19:09:42Z")

</div>

sorry if the question is unclear. I will try to clarify.

using linux my filesystem is bog standard no modifications. SO, in most packages I use I can navigate using the UX to anywhere in the filesystem easily just by clicking the tree structure.

So my expectation would be that I would be able to navigate to /home from jupyter using the file browser but I cannot. Addressing your question, I tried to navigate to /home by clicking on the folder symbol in the file navigator, trying to go “up” using “cd …” no luck. tried to “see” tont\_24 top down no luck despite the fact I am actually IN tont\_24 ( see pwd) I am confused.

As far as jupyter is concerned my whole file system has a “home” at /home/dave/Desktop/tont\_24/data

 ![cant see tont_24](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/3/30e879896eac5b20d163fb0f55310fbca6eecf2d.png)

---

<div class="post-metadata">

### Author: ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)
#### Post date: [December 29, 2023, 7:22pm UTC](https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151/6 "2023-12-29T19:22:40Z")

</div>

As I tried to say in my first reply to you, going higher than Jupyter starts in the file navigator seems to be a problem. You’d need to start Jupyter in `/home`.  
The links in my first post will tell you how to potentially change things to do that. You’d know better since it is your machine and you set up Jupyter on it.

* * *

* * *

As for the notebook in the screenshot…  
I specifically mention in my first reply using **`%cd`**. Note the symbol there is the percent sign that means the magic symbol and not the exclamation point you seem to use in your notebook. They are very different.

I explain it more [here](https://discourse.jupyter.org/t/the-change-directory-command-does-not-work-when-used-with-a-bang/10918/3). It boils down to:

> [@The change directory command does not work when used with a bang](https://discourse.jupyter.org/t/the-change-directory-command-does-not-work-when-used-with-a-bang/10918/3):
>
> Because it is discarded there’s no persistence with `!` unless you pass the output back to the kernel. That isn’t possible with `!cd`.

**In short, you want to use the magic cd command, documented [here](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-cd), in cells when working in Jupyter.**

So what you say (quoted below) is not accurate because you weren’t trying correctly:

> [@j215chic](#):
>
> trying to go “up” using “cd …” no luck

---

<div class="post-metadata">

### Author: ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)
#### Post date: [December 29, 2023, 7:33pm UTC](https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151/7 "2023-12-29T19:33:17Z")

</div>

> [@fomightez](#):
>
> I’m trying to understand if you know that is where it is in your machine’s hierarchy or is that what the file navigator displays in JupyterLab?

And your screenshot and latest text answer this. Thanks.  
As you say, for the sake of the file browser panel, you system thinks the starting point is at `/home/dave/Desktop/tont_24/data`. You cannot click on anything there to go up because it only shows there and below.

---

<div class="post-metadata">

### Author: ![j215chic](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@j215chic](https://discourse.jupyter.org/u/j215chic)
#### Post date: [December 29, 2023, 7:45pm UTC](https://discourse.jupyter.org/t/how-to-navigate-to-the-root-directory-in-linux/23151/8 "2023-12-29T19:45:04Z")

</div>

Sorry about the misread of what you, so kindly, explained in your first post. I am new to notebooks as I used to use pluto over in the julia world so I “think” I was mixing the two worlds with the “!”. I didn’t know about the “%” symbol.

I don’t want to make mods to the jupyter environment config as I like to just run things out of the box unless it’s absolutely necessary. So I’ll figure a way around this using a better project structure.

you have given me a LOT to guide me and I thank you as always. Have an excellent new year and here’s to an exciting 2024 should be FUN!!! given mojo
