The Linux filesystem is structured in a specific way. Essential binaries are in /bin/
, boot loader files are in /boot/
, most device files are in /dev/
, mount points for removable media are in /media/
, etc...
See https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard.
Some minor details may differ from distro to distro (e.g. /usr/bin/
vs. /usr/local/bin/
), but in general almost all Linux distros follow the same directory structure.
To answer your question:
The users' home directories are in /home/
. In principle, Linux is a multi user operating system. You may just have one user account on your laptop with its home directory in /home/<username>/
, but if you look into /home/
on a shared Linux server, you will see many home directories: one for each user account. The idea is that every user of the system has write permissions only in their own home directory. If your username is bob
you can read and write and delete files in /home/bob/
but you cannot touch anything in /home/alice/
or in /var/log/
.
root
is different though. root
is the administrative user and has write privileges everywhere on the system (and can act as any user of the system). So it makes sense that root
has the special home directory /root/
because root
is not a regular user. Other than that, /root/
is just a regular directory with no special magic, although it is quiet possible (even likely) that system utilities rely on /root/
being the home of user root
.
When you execute sudo -i
in a terminal, you switch from being e.g. the regular user bob
to being root
. Note that this switch affects only the terminal window where you typed sudo -i
. For your file manager you are still bob
and if you open another terminal window you are still bob
in there. In this context the symbol ~
is a shorthand for the current user's home directory. For bob
~
means /home/bob/
but for root
~
means /root/
.
I hope that clarifies things for you.
home
directory, but this one is namedroot
sudo -s
to be in the same user directory.man sudo
will answer the question. To be simpleuser -i
is using the root user settings, butsudo -s
the current user settings.