DEV Community

Sreekanth Kuruba
Sreekanth Kuruba

Posted on • Edited on

Linux File System Explained Simply

Most beginners don’t struggle with Linux commands.

They struggle with one invisible problem:

They don’t understand how the Linux file system actually works.

Once this clicks, Linux stops feeling random — and starts feeling predictable.

Let’s fix that.


The Core Idea of Linux File System

Unlike Windows (C:, D: drives), Linux uses one single tree structure.

Everything starts from:

/
Enter fullscreen mode Exit fullscreen mode

👉 This is called the root directory

Think of it as the “starting point of everything” in Linux.

All files, folders, devices, and even processes branch out from here.


Important Linux Mindset Shift

In Linux:

Everything is a file.

That includes:

Files 📄
Folders 📁
Hard disks 💽
USB devices 🔌
Processes ⚙️

This is why Linux feels different — but powerful.


Visualizing Linux Structure

Think of / like the trunk of a tree.

Everything grows from it:

/
├── home
├── etc
├── var
├── usr
├── bin
└── dev
Enter fullscreen mode Exit fullscreen mode

Once you understand this tree, navigation becomes easy.


Paths in Linux (Very Important)

A path tells Linux where something is located.

🔹 Absolute Path

Starts from /

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

✔ Always full location
✔ Works from anywhere

🔹 Relative Path

Starts from where you are currently:

cd documents
Enter fullscreen mode Exit fullscreen mode

✔ Shorter
✔ Depends on current location


Navigation Symbols

.   → current directory  
..  → parent directory  
Enter fullscreen mode Exit fullscreen mode

Example:

cd ..
Enter fullscreen mode Exit fullscreen mode

👉 Go one step back


/home — Your Personal Space

/home/user
Enter fullscreen mode Exit fullscreen mode

Each user gets a personal folder:

Documents
Downloads
Projects
Config files

👉 Think of it as your “workspace”


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 — Your workspace

Where your projects, downloads, and personal files live.


2./etc — System control center

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

👉 If Linux had a “settings app”, this is it.


3./var — Changing data (VERY important)

Used for data that keeps changing:
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 — Temporary space

Used for temporary files.
Usually cleared on reboot

⚠️ Never store important data here.


5./usr — Installed software

Main location for installed user programs and libraries.

Examples:

  • /usr/bin/ — most user commands

Most system commands come from here.


6./boot — Startup system

Contains kernel and boot files.

⚠️ If broken → system may not boot.


7./dev — Hardware as files

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 — Live system data

Virtual filesystem showing:

processes
memory
CPU info

👉 It’s not stored on disk — it’s generated live.


9./root — Admin home

Not the same as /

  • / → whole system
  • /root → admin user’s home

10./mnt & /media — External drives

Used when you plug:

USB
external HDD
extra disks


What is Mounting? (Important Concept)

In Linux, storage devices don’t automatically appear like in Windows.

Instead, they are “attached” to a folder.

This process is called mounting.

Example:

USB drive → mounted to /media
Extra disk → mounted to /mnt
System disk → mounted to /


Useful Commands to Explore the Filesystem

  • pwd → Show current location
  • ls/ → List root directories
  • cd /var/log
  • 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

👉 Once this clicks, Linux becomes predictable.


⚠️ Common Beginner Mistakes

  • Storing important files in /tmp
  • Editing files in /etc without backup
  • Deleting unknown system folders
  • Running this blindly:
Running `rm -rf /` 
Enter fullscreen mode Exit fullscreen mode

⚠️ Never do this.


Summary

You learned:

  • Linux starts from /
  • Everything is a file
  • Absolute vs relative paths
  • Navigation symbols . and ..
  • Important system directories:
  • /home → User files
  • /etc → Configuration files
  • /var → Logs and variable data
  • /tmp → Temporary files
  • /usr → Installed software
  • /boot → Boot files
  • /dev → Hardware devices

Why This Matters

If you understand the Linux file system:

  • Commands become easier
  • Debugging becomes faster
  • Servers stop feeling confusing
  • DevOps becomes logical instead of random

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


Question for You

Which Linux directory confused you the most when you started?

I’ll simplify it in Part 3.


Top comments (0)