Linux Directory Structure Explained for Beginners
The Linux directory structure organises system files, applications, user data and hardware information within a single hierarchical file system. Understanding this structure helps users navigate Linux and manage files without accidentally changing critical system data.
Unlike Windows, Linux does not organise storage around drive letters such as C: or D:. Everything begins from the root directory represented by a forward slash `/`. Other directories, storage devices and partitions connect beneath this root.
This guide explains the Linux file system hierarchy and the purpose of its most important directories.
TL;DR
* `/` is the root of the complete Linux directory structure.
* `/home` stores personal files and settings for regular users.
* `/root` is the home directory of the root administrator.
* `/etc` contains system-wide configuration files.
* `/var` stores logs and other frequently changing data.
* `/usr` contains applications, libraries and shared resources.
* `/bin` and `/sbin` contain important system commands.
* `/tmp` stores temporary files.
* `/dev` represents connected devices.
* `/proc` and `/sys` provide system and hardware information.
* `/boot` contains files required to start Linux.
* `/mnt` and `/media` are used to access mounted storage.
Linux Directory Structure at a Glance
| Directory | Primary purpose | Common contents |
/ |
Starting point of the file system | All Linux directories |
/bin |
Essential user commands | ls, cp, mv and cat |
/boot |
System startup files | Kernel and bootloader files |
/dev |
Device representations | Disks, terminals and USB devices |
/etc |
System configuration | Service and application settings |
/home |
Regular user data | Documents and personal settings |
/lib |
Essential shared libraries | Libraries required by system commands |
/media |
Removable media | USB drives and optical media |
/mnt |
Temporary mount location | Manually mounted file systems |
/opt |
Optional software | Third-party applications |
/proc |
Process and kernel information | Virtual system information |
/root |
Root user’s home directory | Administrator files |
/run |
Runtime system data | Process IDs and sockets |
/sbin |
System administration commands | Startup and maintenance utilities |
/srv |
Service-related data | Web and FTP server data |
/sys |
Hardware and kernel information | Device and driver details |
/tmp |
Temporary data | Short-term application files |
/usr |
Applications and shared resources | Commands, libraries and documentation |
/var |
Frequently changing data | Logs, caches and queues |
What Is the Linux Directory Structure?
The Linux directory structure is a hierarchical system used to organise every file and resource available to the operating system.
The hierarchy begins with the root directory `/`. Every other directory appears below it. This arrangement applies to system files, user files, applications and connected devices.
A simplified Linux directory structure looks like this:
* `/`
* `/bin`
* `/boot`
* `/dev`
* `/etc`
* `/home`
* `/lib`
* `/media`
* `/mnt`
* `/opt`
* `/proc`
* `/root`
* `/run`
* `/sbin`
* `/srv`
* `/sys`
* `/tmp`
* `/usr`
* `/var`
Most Linux distributions follow the Filesystem Hierarchy Standard. This standard defines the purpose of major directories and makes Linux systems easier to understand across different distributions.
Important Linux Directories Explained
1. Root Directory
“`
/
“`
The root directory is the top level of the Linux file system. Every file and directory exists beneath it.
The symbol `/` represents this directory. It should not be confused with `/root` which is the personal directory of the root administrator.
The root directory contains the main folders required for Linux operation:
* System commands
* Configuration files
* User directories
* Application files
* Device information
* Temporary data
* Boot files
Regular users usually have limited permission to modify files directly under `/`. This restriction protects the operating system from unauthorised or accidental changes.
2. Binary Directory
“`
/bin
“`
The `/bin` directory stores essential commands required by regular users and the operating system.
Common commands traditionally associated with `/bin` include:
* `ls` for listing files
* `cp` for copying files
* `mv` for moving files
* `rm` for removing files
* `cat` for displaying file contents
* `mkdir` for creating directories
* `pwd` for displaying the current directory
These commands are considered essential because they may be needed during startup, recovery or maintenance.
Modern Linux distributions may link `/bin` to `/usr/bin`. The command location appears different but the overall purpose remains similar.
Test your Linux directory structure, file paths, permissions, and command-line fundamentals with this mock test and check how ready you are for Linux, cloud, and DevOps interviews.
3. Boot Directory
“`
/boot
“`
The `/boot` directory contains files required to start the Linux operating system.
Important contents may include:
* Linux kernel
* Initial RAM file system
* Bootloader configuration
* GRUB files
* System maps
Deleting or incorrectly editing files inside `/boot` can prevent the system from starting. Changes to this directory should only be made when updating kernels or configuring the bootloader.
Build strong Linux fundamentals to understand the Linux directory structure with HCL GUVI’s Introduction to Linux Shell Scripting with Bash Course. Learn Linux commands, shell scripting, file systems, directory navigation, Bash basics, and practical terminal workflows through structured training designed for beginners.
4. Device Directory
“`https://www.guvi.in/courses/it-and-software/introduction-to-linux-shell-scripting-with-bash/?utm_source=blog&utm_medium=hyperlink&utm_campaign=linux-directory-structure-explained-for-beginners
/dev
“`
Linux represents hardware and virtual devices as files. These device files are stored inside `/dev`.
Examples include:
* `/dev/sda` for a storage disk
* `/dev/sda1` for a disk partition
* `/dev/tty` for terminals
* `/dev/null` for discarding output
* `/dev/random` for random data generation
Applications interact with hardware through these device files. This file-based design creates a consistent method for accessing system resources.
Most files inside `/dev` are created and managed automatically. Users should not manually delete or replace them.
5. Configuration Directory
“`
/etc
“`
The `/etc` directory contains system-wide configuration files. These files control the operating system, applications, networking and system services.
Common files and subdirectories include:
| Location | Purpose |
/etc/passwd |
Stores basic user account information |
/etc/group |
Stores group information |
/etc/hosts |
Maps hostnames to IP addresses |
/etc/hostname |
Stores the system hostname |
/etc/fstab |
Defines file systems mounted during startup |
/etc/ssh |
Contains SSH configuration |
/etc/systemd |
Contains systemd configuration |
/etc/apt |
Stores APT package manager settings |
Configuration files in `/etc` are usually plain text. Administrators can edit them to change system behaviour.
A backup should be created before modifying an important configuration file. A small syntax error may stop a service from running correctly.
6. Home Directory
“`
/home
“`
The `/home` directory stores personal files and settings for regular Linux users. Each user normally receives a separate subdirectory.
For example:
* `/home/rahul`
* `/home/priya`
* `/home/developer`
A user’s home directory may contain:
* Documents
* Downloads
* Pictures
* Videos
* Project files
* Application settings
* Shell configuration files
Hidden files begin with a period. Files such as `.bashrc`, `.profile` and `.config` store user-specific preferences.
A user generally has full control over their home directory but cannot freely access another user’s private files.
7. Library Directories /lib and /lib64
The `/lib` directory contains essential shared libraries required by commands in `/bin` and `/sbin`.
Shared libraries provide reusable functions that multiple programs can access. This approach reduces duplicated code and keeps applications smaller.
The directory may also store kernel modules used to support hardware and system features.
A 64-bit Linux system may include `/lib64` for architecture-specific libraries. Modern distributions may link these directories to corresponding locations under `/usr`.
Users should not manually remove library files. Missing libraries can stop essential commands or applications from working.
8. Media Directory
“`
/media
“`
The `/media` directory is commonly used to mount removable storage automatically.
Examples include:
* USB flash drives
* External hard drives
* Memory cards
* CDs and DVDs
When a removable device is connected, the desktop environment may create a directory beneath `/media`. The device’s files then become accessible through that location.
Some distributions use paths such as `/media/username/device-name` to separate mounted devices by user.
9. Mount Directory
“`
/mnt
“`
The `/mnt` directory provides a location for manually mounting file systems.
System administrators may use it to access:
* Additional disk partitions
* Network file systems
* Backup storage
* Disk images
* Temporary file systems
The difference between `/media` and `/mnt` is mainly based on usage. `/media` is commonly used for automatically mounted removable devices. `/mnt` is generally used for temporary manual mounts.
10. Optional Software Directory
“`
/opt
“`
The `/opt` directory stores optional and third-party software that is not part of the default operating system installation.
A third-party application may keep all its files inside one subdirectory. For example:
* `/opt/application-name`
* `/opt/company-name`
* `/opt/development-tool`
This arrangement keeps external software separate from core system packages. It also simplifies application removal and maintenance.
Commercial tools and manually installed software frequently use `/opt`.
11. Process Directory
“`
/proc
“`
The `/proc` directory is a virtual file system. Its contents are generated by the Linux kernel and do not permanently exist on the disk.
It provides information about:
* Running processes
* CPU details
* Memory usage
* Kernel settings
* Connected hardware
* System uptime
Each running process usually has a numbered directory that matches its process ID.
Important virtual files include:
| Location | Information provided |
/proc/cpuinfo |
Processor information |
/proc/meminfo |
Memory usage and capacity |
/proc/version |
Linux kernel version |
/proc/uptime |
System uptime |
/proc/mounts |
Mounted file systems |
Administrators and monitoring applications read these files to inspect system performance and activity.
12. Root User Directory
“`
/root
“`
The `/root` directory is the home directory of the root administrator.
It is separate from `/home` because the root user must be able to access personal configuration files even when `/home` is unavailable.
This directory may contain:
* Administrative scripts
* Root user settings
* System maintenance files
* Backup configuration files
* Secure credentials
Access is normally restricted to the root user. Regular users cannot enter `/root` unless they receive elevated permissions.
13. Runtime Directory
“`
/run
“`
The `/run` directory stores temporary system information created after the system starts.
Its contents may include:
* Process ID files
* Service status data
* User session information
* Communication sockets
* Lock information
The data inside `/run` is generally cleared when the computer restarts. Services use this directory to store information needed during the current session.
14. System Binary Directory
“`
/sbin
“`
The `/sbin` directory traditionally contains commands used for system administration and maintenance.
These utilities may handle:
* File-system checking
* Network configuration
* System shutdown
* Disk partitioning
* Service management
* System recovery
Many commands in `/sbin` require root permissions. Modern Linux distributions may link `/sbin` to `/usr/sbin`.
The distinction between `/bin` and `/sbin` is based on purpose. `/bin` contains essential general commands. `/sbin` focuses on system administration.
15. Service Data Directory
“`
/srv
“`
The `/srv` directory stores data provided by system services.
It may contain content used by:
* Web servers
* FTP servers
* File-sharing services
* Version-control servers
* Other network services
A web server could use a location such as `/srv/www` for website files. However, actual service paths vary by distribution and server configuration.
The directory separates service-related data from application files and personal user data.
16. System Directory
“`
/sys
“`
The `/sys` directory is another virtual file system created by the kernel. It provides structured information about hardware, drivers and kernel components.
It contains information related to:
* Devices
* System buses
* Kernel modules
* Power management
* Device classes
* Firmware
System tools use `/sys` to inspect and manage hardware. Administrators can sometimes modify certain virtual files to change device behaviour.
The `/proc` and `/sys` directories may appear similar. `/proc` mainly focuses on processes and general kernel information. `/sys` provides a more organised view of devices and hardware.
17. Temporary Directory
“`
/tmp
“`
The `/tmp` directory stores temporary files created by users and applications.
Examples include:
* Temporary downloads
* Application working files
* Installation files
* Session data
* Short-lived processing results
Multiple users and applications can write to `/tmp`. Special permissions prevent users from deleting files owned by others.
Files inside `/tmp` may be removed during startup or through scheduled cleanup processes. Important documents should never be stored there permanently.
18. User System Resources Directory
“`
/usr
“`
The `/usr` directory contains applications, libraries, documentation and shared resources used by the system.
Despite its name, `/usr` does not normally store personal user files. Those belong in `/home`.
Important subdirectories include:
| Directory | Purpose |
/usr/bin |
Most user commands and applications |
/usr/sbin |
Non-essential administration commands |
/usr/lib |
Application libraries |
/usr/share |
Architecture-independent shared data |
/usr/local |
Locally installed software |
/usr/include |
Development header files |
/usr/src |
Source code such as kernel sources |
The `/usr/local` directory is particularly useful for software installed manually by an administrator. It keeps local applications separate from distribution-managed packages.
19. Variable Data Directory
“`
/var
“`
The `/var` directory stores data that changes while the Linux system operates.
This data may grow over time. Administrators must monitor it to prevent logs or caches from consuming all available storage.
Important subdirectories include:
| Directory | Purpose |
/var/log |
System and application logs |
/var/cache |
Cached application data |
/var/lib |
Persistent application state |
/var/spool |
Queued tasks and messages |
/var/tmp |
Temporary files retained longer than /tmp files |
/var/www |
Web server content on some systems |
/var/mail |
User mailboxes |
The `/var/log` directory is especially important during troubleshooting. Logs can reveal service failures, authentication attempts and system errors.
Absolute Paths vs Relative Paths in Linux
Linux uses paths to identify the location of files and directories.
Absolute Path
An absolute path begins with `/` and shows the complete location from the root directory.
Example: `/home/user/Documents/report.txt`
This path identifies the file regardless of the user’s current location.
Relative Path
A relative path begins from the current working directory.
Example: `Documents/report.txt`
Relative paths are shorter but depend on where the user is currently working.
Special path symbols include:
* `/` for the root directory
* `.` for the current directory
* `..` for the parent directory
* `~` for the current user’s home directory
Understanding paths is essential for command-line navigation, shell scripting and file management.
Linux Directory Structure vs Windows File Structure
| Linux | Windows |
Uses one root directory / |
Uses drive letters such as C: and D: |
| Treats devices as files | Lists devices as separate drives |
| Uses forward slashes | Uses backslashes |
| File names are usually case-sensitive | File names are usually case-insensitive |
User files are stored under /home |
User files are stored under C:\Users |
Configuration is commonly stored in /etc |
Configuration often uses the Registry and application folders |
| Software may be distributed across standard directories | Software commonly uses Program Files |
Linux presents all partitions and devices within one directory tree. Windows displays storage devices through separate drive letters.
Why Should Beginners Learn the Linux Directory Structure?
Understanding the Linux file system helps beginners avoid random navigation and unsafe changes.
It also makes several technical tasks easier:
* Finding configuration files
* Examining system logs
* Managing user data
* Installing applications
* Troubleshooting services
* Writing shell scripts
* Configuring web servers
* Managing cloud virtual machines
* Working with Docker containers
* Preparing for Linux interviews
Linux is also a foundational skill for the practical tasks covered in these DevOps project ideas for beginners.
Learners targeting infrastructure roles can follow this guide on how to start learning cloud computing from scratch.
Best Practices for Working with Linux Directories
Follow these practices while navigating or managing a Linux system:
* Confirm the current directory before changing or deleting files.
* Avoid modifying `/boot`, `/lib`, `/proc` and `/sys` without a clear reason.
* Create backups before editing files inside `/etc`.
* Store personal files inside the correct `/home` directory.
* Do not use `/tmp` for permanent data.
* Review `/var/log` when troubleshooting system problems.
* Use administrator permissions only when necessary.
* Check file ownership and permissions before making changes.
* Keep manually installed applications organised under `/usr/local` or `/opt`.
* Learn the purpose of a directory before deleting its contents.
Practical directory management can also strengthen the command-line projects listed in these coding project ideas for beginners.
Final Words
The Linux directory structure organises the complete operating system beneath the root directory `/`. Each major directory serves a defined purpose.
The `/home` directory stores user data while `/etc` stores system configuration. The `/var` directory contains changing data such as logs. The `/usr` directory holds most applications and shared resources. Virtual directories such as `/proc` and `/sys` provide live system information.
Beginners do not need to memorise every directory immediately. Start with `/home`, `/etc`, `/var`, `/usr` and `/tmp`. Explore the remaining directories as you practise Linux administration, cloud computing or DevOps.
FAQs
1. What Is the Root Directory in Linux?
⌄
The root directory / is the top level of the Linux file system. Every file, directory, partition and mounted device is organised beneath it.
2. What Is the Difference Between/ and /root?
⌄
/ is the root of the complete Linux file system. /root is the personal home directory of the root administrator.
3. Where Are User Files Stored in Linux?
Regular user files are stored inside /home. Each user normally has a separate directory such as /home/username. The root administrator’s files are stored in /root.
4. Where Are Linux Configuration Files Stored?
Most system-wide configuration files are stored inside /etc. User-specific application settings are commonly stored as hidden files or directories inside the user’s home directory.
5. Where Are Linux Log Files Stored?
Linux system and application logs are generally stored inside /var/log. These logs help administrators diagnose service failures, security events and system errors.
Related Posts


Data Analyst Salary in 2026: Freshers to Experienced Salary Guide
Data analytics continues to attract students and career switchers because it offers a relatively accessible entry into technology and business …
Warning: Undefined variable $post_id in /var/www/wordpress/wp-content/themes/placementpreparation/template-parts/popup-zenlite.php on line 1050









