Difference between / and /root in Ubuntu?
I have created 100 GB for /
. When I opened Nautilus I have found the root
folder. So what is difference between /
and /root
?
My username is enigma
, and I have a folder named enigma
in the /home
folder and another folder with the same name in /media
. What is the difference between these two folders and when do I have to use the second folder?
In a nutshell:
/
is called the root directory, for the whole system; all directories of the system descend from this directory one way or another./root
is theroot
user's (more precisely the user with UID 0's) home directory
If you're coming to the Linux world (taking Ubuntu flavour as your choice or other one) from the Microsoft Windows world, then these folder structures might seem very confusing.
To answer your question, let me give a very brief introduction to the Linux filesystem. In a Linux filesystem every possible and accessible files, folders are created under the "root" filesystem and in Linux system it's denoted as "/" symbol (unlike Windows, where different Drives are created, named C:, D: etc. and you can create and store your files and folders inside those drives). In Windows, the OS is most of the time installed in C: drive. In Linux, everything comes under / (aka "root" directory). When you install the Ubuntu OS, you'll notice that, several existing folders are already there inside /. Open nautilus and click "File system" (or in some new version "Computer" under Devices) in the left sidebar. This is actually what is inside /. Among those folders there are two named "root" and "home".
Now, In every Linux system, there is a root user who has all the power to change anything inside the OS (the super-admin ;), as I like to call it). You can create other users too. Whenever a new user is created, they'll have there own personal folder inside /home, e.g. /home/enigma (equivalent to C:\users\enigma in Windows). root user is the special one, who has one for his/her own directly under /, e.g. /root. Any user's personal directory is exclusively accessible to only that user (not technically only that user as root user can go & check & change anywhere). The other one with the same name as the User's name under /media is for mounting (beyond the scope of this discussion for mount, sorry, have to learn separately) storage devices like external HDD, Pendrive, CD/DVD etc. Modern Ubuntu handles them nicely and give a shortcut to those devices on the desktop. But, if you want to access those files through the terminal (command line), then you have to traverse like
cd /media/enigma/ <your device name>/<folder/file name>
/
is the root. /root
is a folder called root
in your root folder (/
)
/home/enigma
is your home folder; ie., where your documents are stored, your Desktop, your Music, your videos, your configuration files, etc. /media/enigma
is the folder where removable devices, ex, USB sticks, external hard drives, cd's, etc. are mounted. In other words, if you want to access a removable drive, the place you would go to would be /media/enigma/1TB drive
or whatever the name of your drive is.
The difference between /
and /root
is easy to explain. /
is the main tree (root) of the whole Linux file-system and /root
is the admin's user-directory, equivalent to yours in /home/<username>
.