What's the name of the top-level directory
This directory is called the root directory and is referenced by the symbol "/"
You can try cd /
to go there.
Notice that if you try this:
$ cd /
$ cd ..
You're still at the root directory.
NB: Every Unix system has a super user account called root, whose home directory is /root
. I know it's redundant, it can be ambiguous and lead to confusion. So make sure, every time you mention "root" to know whether it refers to the directory /
or the (super)user.
Related videos on Youtube
Mellon
Updated on September 18, 2022Comments
-
Mellon almost 2 years
I am using Ubuntu.
I know by using
cd ~/
, I can go to home/ directory.But if I want to go to the directory (I do not know the official name of this directory) which contains
etc/
,var/
,opt/
, ... sub-directories, what is the symbol used to refer to this directory? (And by the way what is the official name of this directory? root directory?)Basically, I would like to
cd
to that directory without usingcd ..
but one symbol to refer to it, is there such a symbol for it (like~
refers to home directory)?-
Admin over 12 yearsBtw, you can use
cd
without args to go to your home. -
Admin over 12 yearsand you dont have to write the leading
/
--cd ~
without the/
is enough
-
-
Mellon over 12 yearsdo you mean "cd .." will stop when it reaches the root directory? Can I understand in this way?
-
rahmu over 12 yearsYes that's a very good way to look at it. My advice to you is to experiment as much as you can and read a unix tutorial. (hint:
pwd
will output your current working directory) -
Fiasco Labs over 12 yearsIt's the root of the tree and is written as /. In node parlance, everything branches off from root until you get to the leaf nodes (files)