Skip to main content

Command Palette

Search for a command to run...

Linux File System

Published
β€’3 min read
A

DevOps engineer sharing daily learnings on Linux, Docker, Kubernetes, CI/CD, and Cloud.

The Linux file system is a hierarchical structure that starts from a single root directory /. Unlike Windows (which uses drives like C: or D:), Linux uses one unified directory tree.

/
β”œβ”€β”€ bin
β”œβ”€β”€ boot
β”œβ”€β”€ dev
β”œβ”€β”€ etc
β”œβ”€β”€ home
β”œβ”€β”€ lib
β”œβ”€β”€ proc
β”œβ”€β”€ root
β”œβ”€β”€ sbin
β”œβ”€β”€ tmp
β”œβ”€β”€ usr
└── var

This structure follows the Filesystem Hierarchy Standard (FHS).

Root Directory /

  • The starting point of the entire Linux file system

  • All other directories are mounted under /

  • You cannot delete or rename it

πŸ“Œ Think of / as the foundation of Linux

Important Linux Directories Explanation :

  1. πŸ“‚ /bin – Essential User Binaries :
  • Contains basic commands used by all users

  • Available even in single-user mode

Examples :

ls, cp, mv, rm, cat, echo
  1. πŸ“‚ /sbin – System Binaries :
  • Contains commands mainly used by the root user

  • Used for system administration

Examples :

ip, reboot, shutdown, fsck
  1. πŸ“‚ /etc – Configuration Files :
  • Stores system-wide configuration files

  • No binaries here

Examples:

  • /etc/passwd β†’ User information

  • /etc/hosts β†’ Hostname mappings

πŸ“Œ Editing files here directly impacts system behavior

  1. πŸ“‚ /home – User Home Directories :

    • Each user gets a personal directory

    • Non-root users store their data here

Examples :

/home/apurv
/home/devops

πŸ“Œ This is where user-level work happens

  1. πŸ“‚ /root – Root User’s Home :
  • Home directory for the root user

  • Different from /home

πŸ“Œ Keeps admin data isolated from regular users

  1. πŸ“‚ /var – Variable Data :

    • Stores files that grow over time

Common subdirectories:

  • /var/log β†’ System logs

  • /var/lib β†’ Application state data

  • /var/spool β†’ Mail, cron jobs

πŸ“Œ Logs are stored here for troubleshooting

  1. πŸ“‚ /tmp – Temporary Files :
  • Used for short-lived files

  • Often cleared on reboot

πŸ“Œ Anyone can write here, so permissions matter

  1. πŸ“‚ /usr – User System Resources :
  • Contains user applications and libraries

  • Not user-specific despite the name

Important paths:

  • /usr/bin β†’ User commands

  • /usr/sbin β†’ Admin commands

  • /usr/lib β†’ Libraries

πŸ“Œ /usr is usually read-only in production systems

  1. πŸ“‚ /lib & /lib64 – Shared Libraries :
  • Libraries required by binaries in /bin and /sbin

  • Essential for system boot

  1. πŸ“‚ /dev – Device Files :

Represents hardware devices as files

Examples :

/dev/sda   β†’ Hard disk
/dev/null β†’ Discards output

πŸ“Œ Devices are accessed like files in Linux

  1. πŸ“‚ /proc – Process Information :
  • Virtual file system

  • Contains runtime system information

  • Helps in debugging & performance analysis

  • Used by monitoring tools like:

top
ps
htop
  1. πŸ“‚ /boot – Boot Loader Files

    • Contains kernel and boot-related files

    • Critical for system startup

πŸ”š Conclusion

Understanding the Linux file system is non-negotiable for anyone working with Linux.
It forms the base for:

  • Commands

  • Permissions

  • Troubleshooting

  • Automation

Linux Essentials

Part 2 of 5

Linux Essentials is a practical series covering core Linux concepts from a DevOps perspectiveβ€”architecture, filesystem, permissions, processes, networking, and servicesβ€”focused on real-world usage in production and cloud environments.

Up next

Package Management in Linux

What is package management? Package management is the process of: Installing software Updating packages Removing applications Managing dependencies In Linux, software is distributed as packages and handled by package managers. πŸ“Œ A package cont...