This article talks about the basics of different Linux file system structures.
For more on this subject, please refer to the SOC Table of Contents.
Linux File System Structure
While the root directory for the Windows C disk is “C:”, the root directory for Linux is “/”.
We can see this by opening the Ubuntu file explorer in the taskbar on the left.
We aren’t directly in the root directory like with Windows, where opening the C disk would take us directly to the root directory of C disk. Because Ubuntu supports multiple users, Ubuntu creates a root directory for each and every user, which would have the address of /home/[username].
Because the system is currently logged in as the “ubuntu” user, it takes us into the root directory for the “ubuntu” user.
In order to access Ubuntu’s root folder “/”, one only needs to click on the Computer tab on the left of the files page.
The user may freely edit the files that are under their own root directory, but you may find that you don’t have the permissions to edit the files under the “/” root directory. When you open the Terminal, you are taken to the current user’s root directory by default. For example, if we open up the Terminal and execute the “ls” command to see what files are there, we will see the following.
Which matches with what we saw in the root directory for the “ubuntu” user.
In order to see what files are under the root directory “/”, we first execute “cd /” to take us to the root directory “/”. We then execute the “ls” command to see the files.
Here, we can see the System root files and folders.
/bin
Stores binary executable files, and /usr/bin stores certain files based off user commands.
/sbin
Stores many system commands, as with /usr/sbin.
/root
The superuser root’s root directory.
/home
The default directory for the average user. Each user has a folder under this directory.
/boot
Stores the core of the Ubuntu system, as well as system start-up files.
/mnt
Usually includes the mount point of the file system that is mounted after the system boots.
/dev
Stores the device files. Widely used in correspondence with Linux drivers.
/etc
Stores the configuration files and directories needed to manage the system.
/lib
Stores the library files needed for system programs, while /usr/lib stores library files for the average user
/lost+found
Typically empty. When the system is shut off unexpectedly, this folder would store some scattered files as a recovery attempt.
/var
Stores files that are constantly changing, such as various log files.
/usr
Includes files and directories directly related to the system user, such as applications and essential library files.
/media
Stores device files automatically mounted by the Ubuntu system.
/proc
Virtual directory. Isn’t actually stored on the disk and is typically used to store system information as well as process information.
/tmp
Store the temporary files of both the system and the user. All users have the permission to read and write contents of the folder.
/opt
Optional file and program storage directory.
/sys
System device and file hierarchy and provides the necessary core information to user programs.