DEV Community

Sreekanth Kuruba
Sreekanth Kuruba

Posted on

Linux File System Explained Simply

Most beginners get confused in Linux not because of commands — but because they don’t understand the file system.

Once you understand how Linux organizes files, navigating any server becomes much easier and more predictable.

Unlike Windows, Linux uses a single tree structure starting from the root directory (/).

In this guide, you’ll learn the most important Linux directories and what they are used for.


Important Linux Concept

In Linux, almost everything is treated like a file:

  • Regular files
  • Directories
  • Hard disks
  • USB devices
  • Processes

This is one of the core ideas behind Linux design.


Overview of Linux File System

Everything in Linux starts from / (root).

/ is called the root directory.

It is the top-level starting point of the Linux filesystem.

All other directories are sub-directories of root.


Understanding Paths in Linux

A path tells Linux where a file or directory is located.

Absolute Path

Starts from the root directory /.

Example:

cd /home/user/documents
Enter fullscreen mode Exit fullscreen mode

-> Full location from the root.


Relative Path

Starts from your current directory.

Example:

cd documents
Enter fullscreen mode Exit fullscreen mode

-> Relative to where you are currently located.


Current Directory Concepts

Linux uses special symbols for navigation:

.   → Current directory
..  → Parent directory
Enter fullscreen mode Exit fullscreen mode

Examples:

cd .
cd ..
Enter fullscreen mode Exit fullscreen mode

-> cd .. moves one directory back.


Understanding /home

/home is the personal workspace area for normal users.

Examples:

/home/john
/home/admin
Enter fullscreen mode Exit fullscreen mode

Each user usually has their own home directory to store:

  • Documents
  • Downloads
  • Personal files
  • Configuration files

Important Linux Directories

Directory Purpose Common Usage
/ Root directory (starting point) Everything is inside this
/home User personal files Documents, Downloads, Desktop
/etc Configuration files System & application settings
/var Variable data (logs, caches, queues) Logs, web server data
/tmp Temporary files Deleted on reboot
/bin Essential binary commands ls, cp, mv, cat
/usr User installed programs & libraries Most installed software
/root Home directory of root (admin) user Administrator files
/boot Boot loader and kernel files Files needed to start the system
/dev Device files Hard disks, USB, terminals
/proc Process and system information Live system data (virtual)
/sys Kernel & hardware information System hardware details
/opt Optional software Third-party applications
/mnt / /media Mount points for external drives USB drives, additional disks

Detailed Explanation of Most Used Directories

1. /home
User’s personal space.
Every normal user has a folder here.


2. /etc
Contains almost all configuration files.
This is one of the most critical directories in Linux systems.

  • /etc/passwd — user accounts
  • /etc/ssh/sshd_config — SSH settings
  • /etc/nginx/ — web server config

3. /var
Stores data that changes frequently.
Most production issues can be traced by checking logs in /var/log.

  • /var/log/ — system and application logs
  • /var/www/ — Default web files (for Apache/Nginx)

4. /tmp
Used for temporary files.
Usually cleared automatically after reboot.


5. /usr
Main location for installed user programs and libraries.

Examples:

  • /usr/bin/ — most user commands

Most system commands come from here.

6. /boot
Contains kernel and files required to boot the system.
Corruption here can prevent the system from booting.


7. /dev
Represents hardware devices as files.

Examples:

  • /dev/sda → hard disk
  • /dev/tty → terminals

Everything in Linux is treated as a file, including hardware.


8. /proc

Virtual filesystem that shows live process and kernel information.

Used for viewing system and process details.


9. /root

/root is the home directory of the root (administrator) user.

-> It is different from / (root directory).


10. /mnt and /media

These directories are commonly used when attaching external storage devices.

Examples:

USB drives
Additional disks


What is Mounting?

Linux attaches storage devices to directories using a process called mounting.

Examples:

/ → Main filesystem
/home → User files
/var → Logs and application data


Useful Commands to Explore the Filesystem

pwd
ls /
cd /var/log
tree

  • pwd → Show current location
  • ls/ → List root directories
  • cd → Navigate directories
  • tree → Visual directory structure

Simple Mental Model

Think of Linux filesystem like this:

  • / = The whole computer
  • /home = My personal room
  • /etc = Settings room
  • /var = Logs & changing data
  • /tmp = Temporary workspace
  • /usr = Installed applications
  • /boot = Engine to start the system

This model helps you quickly understand Linux structure without memorizing paths.


⚠️ Common Beginner Mistakes

  • Storing important files in /tmp
  • Editing files in /etc without backup
  • Deleting unknown folders thinking they are useless
  • Running rm -rf / (Never do this!)

Summary

  1. In this guide you learned the most important Linux directories:
  • /home → User files
  • /etc → Configuration files
  • /var → Logs and variable data
  • /tmp → Temporary files
  • /usr → Installed software
  • /boot → Boot files
  • /dev → Hardware devices

2. In this guide you learned:

  • Linux filesystem structure
  • Root directory (/)
  • Absolute vs relative paths
  • Current directory concepts (. and ..)
  • Important Linux directories
  • Mounting basics
  • Useful filesystem navigation commands

Understanding these directories is essential for navigating, troubleshooting, and managing Linux systems in real-world DevOps environments.


Next Post:
Linux File Permissions Explained Simply (chmod, chown, chgrp)

Top comments (0)