An Introduction to the Contents of Linux Root Directory
Find out what the root directory contains and why each subdirectory is there!
The Linux root directory is home to a lot of different files and subdirectories. If you have ever tried typing ls -a /
in your terminal, you must have seen them. Alternatively, go to your home directory in a GUI file explorer and then navigate up to the root directory from there. In any case, you will see a list that looks similar to this:

In today's post, we want to talk about what each of those folders is dedicated to.
Linux Root Directory: What It Is
The Linux root directory, a.k.a. /
, is the highest directory (folder) in the hierarchy of the Linux filesystem. Being the highest in the hierarchy, the root directory is the parent to any file or folder that you have on your device. Considering that and the fact that everything is a file in Linux, you can conclude that anything in your OS, from files to processes and packages, is placed in the root directory. Thus, there is a lot of vital system information in your root directory. That's why you shouldn't try to change or remove anything when you pay a visit.
What the Root Directory Contains
As mentioned above, everything is in the root directory. However, what does that mean? What are all of these folders? What is each of them dedicated to? Good questions.
But first, let's talk about the prerequisite of understanding what it means for a directory to contain everything: everything is a file.
Everything Is a File
The idea of everything being a file is a very central idea to the Linux filesystem. From stored files to devices and from processes to applications, everything is a file in the Linux operating system. Why? In order to have a completely unanimous way of interacting with different things. There are basic ways of interacting with files that are very essential and basic to the notion of a Linux operating system. We call them IOs since they are a set of ways to Input and Output information. Now, this input and output of information is much easier if every file in the filesystem has the same protocol for giving and getting information, isn't it? That's exactly why everything is a file.
If a device like your keyboard or mouse gets some information and wants to tell your computer about it, the information is given to your computer through the contents of a file. That's how things are made easier to handle through this central philosophy of "everything is a file."
All of the above said, you need to also know that a large amount of the operating system is always in your RAM and not stored in the filesystem. That is a different story, and of course, not everything is a file there.
The Files
Now, in the root directory of your operating system, there are different folders (or subdirectories), and each of those contains a specific type of file. In an earlier post, we talked about the loop devices in Linux and said that they are in the /dev
subdirectory. You may be able to guess that the /dev
folder must then contain device files. Just like that, we have folders for programs, settings, files necessary for booting the device, and so on. Let's explore them all in more detail:
/bin
: Contains essential user binaries that are required for basic system operation. Binaries are executable program files coded in 0s and 1s to make running them faster and easier. These commands are available for all users. Some examples are:ls
,cp
, andmv
./boot
: Contains files that are necessary for booting the system. This includes the Linux kernel, initial RAM disk image, and bootloader configuration files./dev
: Contains the device files that represent hardware devices and pseudo-devices. The contents of this directory allow software to interact with hardware components, such as hard drives, USB devices, and terminals./etc
: Contains system-wide configuration files and directories. These system-wide configurations include settings for system services, user accounts, and various applications. For example,/etc/passwd
contains user account information./home
: Contains the home directories for regular users. Regular users are the ones like yourself and any other people who might use your computer. Note that other than that, there are other "users" defined for the Linux OS as well, which we will talk about in another post. Each user has a subdirectory here (named/home/<username>
) where personal files and configurations are stored./lib
: Contains essential shared libraries and kernel modules required for the binaries in/bin
and/sbin
to run./media
: This subdirectory is a mount point for removable media such as USB drives, CDs, and DVDs. When you insert a removable device, the files are made available under this directory–which is called "mounting."/mnt
: A generic mount point for temporarily mounting filesystems. Knowledgeable Linux users often use this directory to mount filesystems manually./opt
: Contains optional software packages that are not part of the default installation. This is often used for third-party applications./proc
: This directory is a virtual filesystem that provides information about system processes and kernel parameters (we will discuss what a virtual filesystem is). It contains files that represent the system and process information. An example is/proc/cpuinfo
for CPU details./root
: The home directory for the root user (just like the folder that each regular user has in/home
). This is where the root user's personal files and configurations are stored./run
: A temporary filesystem that stores runtime information, such as system information and process IDs. This data is cleared when you reboot your computer./srv
: Contains data for services provided by the system, such as web server files or FTP server files./sys
: A virtual filesystem that provides a view of the kernel's device model and allows interaction with kernel parameters. It is used to manage devices and kernel features./tmp
: A directory for temporary files that are created by applications and users. Files in this directory are usually deleted after rebooting./usr
: Contains user-related programs and data. It is further divided into subdirectories like/usr/bin
(user binaries),/usr/lib
(libraries), and/usr/share
(shared data)./var
: Contains variable data files, such as logs, databases, and spool files. This directory is used for files that are expected to change in size and content.
Virtual Filesystems
Virtual filesystems are different from filesystems in that they are abstract. As we discussed above, filesystems contain concrete files on the storage device. Unlike those, virtual filesystems are an abstract layer in the Linux kernel that lets the kernel interact with different filesystems in a unified way. That's why folders like /sys
and /proc
that deal with processes are virtual filesystems that hide the complexities of how interaction with a process is different from interaction with a file. Instead, they let the kernel interact with everything through a unified IO protocol, although processes are not files.
Conclusion
In this article, we discussed the different subdirectories or folders in the Linux root directory, the philosophy that "everything is a file," and the most important files in the Linux filesystem.
I'm Farhang, a Linux and programming enthusiast. This is my blog. Check out my other posts!