Navigating Filesystem Levels

Hello!

I am confused about how exactly levels work in the filesystem.
For, instance, if my working directory was porteur/, would I have to use cd../.. to get to freight/, or is it that porteur/ and messenger/ are at the same level so I would only need to move use cd.. ?

In this diagram, anything with the same indent is on the same level. So mountain would be the parent of downhill, which is the parent of both heavyweight and lightweight. For your question, we can see that messenger and porteur are on the same level, and are both child elements of freight.

Therefore if your WD was porteur and you wanted to move to freight, it would simply be cd .. . Similarly, say you wanted to move from porteur to messenger, you would want to move up to freight and then down to messenger, therefore it would be cd ../messenger.

4 Likes

Filesystem tree for reference:

I am confused about the reason for including a forward slash when navigating to a certain path in the file system.

For example, both $ cd freight/ and $ cd freight return messenger porteur when I type $ ls into the terminal…

Hi @taylorrayne,

Like said above (and AFAIK) it’s only really necessary if you need to access something inside that directory (like a file or a nested directory). Otherwise, you don’t need to include it yourself.

1 Like