Skip to main content

Linux File System Hierarchy


Understanding the Linux File System Hierarchy: A Complete Guide for Beginners

When you first switch from Windows or macOS to Linux, the file structure can look like a confusing maze of short, cryptic folder names. Unlike Windows, which uses a "C: Drive" as the root, Linux follows a unified structure known as the Filesystem Hierarchy Standard (FHS).

In these notes, we will break down exactly where every file lives in your Linux system, why the directory structure is built this way, and the essential commands you need to navigate it like a pro.


What is the Filesystem Hierarchy Standard (FHS)?

The FHS is a set of guidelines that defines the main directories and their contents in Linux operating systems. Because of this standard, whether you are using Ubuntu, Fedora, Arch, or Kali Linux, the configuration files will almost always be in /etc and your user files will always be in /home.

The Root Directory ( / )

Everything in Linux starts at the Root. It is represented by a single forward slash (/). Unlike a tree on earth, the Linux tree grows downwards from the root.


1. /bin – Essential User Binaries

The /bin directory contains the executable programs (binaries) required for the system to run in single-user mode. If you are using basic commands, you are likely executing files from here.

  • Common files found here: ls, cp, mkdir, cat, ps.

  • Note for TodayNotes: In modern 2026 Linux distros, /bin is often a symbolic link to /usr/bin.

2. /boot – Static Boot Loader Files

This is one of the most critical directories. It contains everything needed to boot the system.

  • Contents: The Linux Kernel (vmlinuz), the RAM disk image (initrd), and the GRUB bootloader settings.

  • Pro-Tip: Never delete files in this folder unless you are upgrading your kernel, or your system will fail to start!

3. /dev – Device Files

In Linux, "Everything is a file." This directory contains files that represent hardware components.

  • Examples: /dev/sda represents your hard drive, and /dev/nvidia0 might represent your GPU.

  • Note: You don't "edit" these files; the system uses them to communicate with hardware.

4. /etc – Configuration Files

Think of /etc as the "Control Panel" of Linux. It contains all the system-wide configuration files.

  • Key Files: * /etc/passwd: User account information.

    • /etc/fstab: Information about disk drives and mounting.

    • /etc/hosts: Local IP to hostname mapping.

  • SEO Insight: If you are writing a tutorial on "How to change a static IP," the reader will always look in the /etc folder.

5. /home – The User Space

This is where you live. Every user on the system (except the Root user) has a subdirectory here.

  • Path: /home/yourname

  • Contents: Your Documents, Desktop, Downloads, and personal configuration files (hidden files like .bashrc).

6. /root – The Superuser Home

Don't confuse / (root directory) with /root (root user's home). To maintain security, the administrative "root" user has their own separate home folder outside of the standard /home path.

7. /lib, /lib32, /lib64 – Essential Shared Libraries

These directories hold the library files that the binaries in /bin and /sbin need to run. They are similar to .dll files in Windows.

8. /media and /mnt – Mount Points

  • ** /media:** This is where the system automatically mounts "removable" media like USB drives or external SSDs.

  • ** /mnt:** This is a place for administrators to "manually" mount temporary filesystems (like a network drive).

9. /opt – Optional Add-on Apps

When you install third-party software that doesn't follow the standard Linux package format (like Google Chrome, Zoom, or certain proprietary tools), they often install into the /opt directory.

10. /proc and /sys – Virtual Filesystems

These are "pseudo" directories. They don't actually exist on your hard drive.

  • ** /proc:** Contains information about running processes and system resources (like CPU info).

  • ** /sys:** Used for interacting with the kernel and hardware drivers.

11. /sbin – System Binaries

Similar to /bin, but contains "System Admin" tools. These are commands typically run by the root user for system maintenance.

  • Examples: iptables, fdisk, reboot, shutdown.

12. /tmp – Temporary Files

Applications use this folder to store temporary data.

  • Crucial Note: In most Linux distributions, the contents of /tmp are deleted automatically every time you reboot.

13. /usr – User Binaries & Data

Historically standing for "Unix User Resources," this is now the largest directory in many systems. It contains the majority of user utilities and applications.

  • /usr/bin: General user executable files.

  • /usr/share: Architecture-independent data (like icons, fonts, and documentation).

14. /var – Variable Data Files

This is where the system stores data that is constantly changing.

  • ** /var/log:** The most important folder for troubleshooting. It contains all system and application logs.

  • ** /var/www:** The default location for web server files (like your HTML/CSS files if you run Apache).

  • ** /var/mail:** Where system emails are stored.

Comments

Popular posts from this blog

Generate Multi Domain SSL Certificate by useing cert bot tool from Let's Encrypt.

 We are using cert bot tool to generate / create multi domain certificate from Let's Encrypt CA. we are using following command  create CSR config file to generate CSR: Example of csr file is: default_bits            = 2048  # RSA key size encrypt_key             = no  # Protect private key default_md              = sha256  # MD to use utf8                    = yes  # Input is UTF-8 string_mask             = utf8only  # Emit UTF-8 strings prompt                  = no  # Prompt for DN distinguished_name      = s...

How to Check all user logged in Linux server?

We are learning how to get all logged in user name in a Linux server you need administrative privileges to execute commands cover here.    There are many ways to list logged in user on a Linux machine. Here I am covering my three favourite  method for this purpose. All this command run with any fedora based system like Red Head Linux , Centos, Rocky Linux, Amla linux etc. 1. lastlog : you can use list command to know all login user. this command uses file available in /var/log/lastlog. This command read data from the mentioned file and present in a human readable from     You can use grep command to filter output and show only currently logged in user by following command. lastlog | grep -v 'Never' In this example we use grep -v switch to exclude all line containing Never. This way we find all currently logged in user. 2. W command : This is more preferable way to get all logged in user, it uses file mentioned on lastlog command and file situated on /proc...

How to Clear Putty Screen while working with Linux Server?

 Method to clear putty screen while working with Linux Server. It will clear screen buffer and provide true experience of clear screen ( console ).  Have you ever worked remotely with Linux system? it is common to work remotely on Linux system. Putty is popular remote login tool in system admin community. It's freely available open source software and it works on Linux as well as Windows platform. It's widely adopted tool for remote login. Figure: Putty Icon - Popular Remote Login Software. Now imagine you are connected remotely with a Linux system and you are troubleshooting some problem. You are typing command on putty console  and running it and after some time all screen field with lot of text. Screen become messy with full of text  and create confusion while troubleshooting Linux system. After then you type clear command on console and all text cleared as you execute clear command but as soon as you touch scroll bar or up down arrow key, text returned on console...