☯︎ Li

Linux Root Directory

When we login into our user account on Linux, we are placed into our home directory inside a shell. Our home directory is a subdirectory of the /home directory. At the very top level of Linux filesystem, there is the root directory, which is represented by the / symbol. You can relate this to C: in Windows. However on Windows we can have many drive letters that all have their own root levels, such as C:, D:, E:, and so on.

In Linux, there is only one root directory /. All other directories are subdirectories of the root directory. The following table gives a brief overview of files and the information contained in each directory.

Directory Description
/ The root filesystem only contains other directories but no individual files.
/bin The binaries directory contains executable files. Points to /usr/bin.
/dev The device directory contains device files of users and services.
/etc Contains system configuration files for users and services.
/home User's home directories
/lib System libraries files. Points to /usr/lib
/media Directory for mounting media such such as USB drivers or DVD disks.
/mnt The mount directory for mounting remote filesystems.
/opt Directory in which third-party software is installed
/proc A virtual filesystem that tracks system processes.
/root The root user's home directory
/run Variable and volatile run-time data.
/sbin System binary (executable) files.
/srv Might contain data from system services.
/sys Contains kernel information.
/tmp Temporary file directory for session information and temporary file storage.
/usr Programs and libraries for users and user-related programs.
/var Variable files such as logs, spools, and queues.

For the note, system files are protected from user modification. Only the root (administrative) user can modify system configuration files and settings. Users generally only have write access to their own home directories, the /tmp directory, and shared directories specifically created and modified by the administrator.

#linux