DEV Community

Cover image for πŸ“˜ Linux Filesystem Hierarchy
Shiva Charan
Shiva Charan

Posted on

πŸ“˜ Linux Filesystem Hierarchy

πŸ“‚ What is a Filesystem?

  • A filesystem is simply the method an operating system uses to keep track of files on a disk or partition.

  • It is the way files are organized and managed so the computer knows where everything is stored.


🌳 The "Tree" Structure

  • Unlike Windows, which uses different "drives" like C:, D:, and E:, Linux uses a single hierarchical structure.

  • Everything starts from one place called the root directory, represented by a single forward slash (/).

  • All other folders and files "branch out" from this root like a tree.


πŸ”‘ Key Differences from Windows

πŸ”Ή The Slash

Linux uses the forward slash (/) for directories, whereas Windows uses the backslash (\).

🐧 Linux πŸͺŸ Windows
/home/charan/docs C:\Users\Charan\docs

πŸ”Ή Case Sensitivity

Linux cares about capital letters. For example, a file named:

Work
Enter fullscreen mode Exit fullscreen mode

is completely different from:

work
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Organized by Function

In Windows, a program usually keeps all its files in one folder:

C:\Program Files\App
Enter fullscreen mode Exit fullscreen mode

In Linux, a program's files are split up and placed into different folders based on what they do.

For example:

πŸ“ File Type πŸ“ Linux Location
Program binaries /usr/bin
Configuration files /etc
Help manuals /usr/share/man

πŸ’½ Mounting and Safety

πŸ”Ή Mounting

In Linux, your computer doesn't automatically "see" a new disk or USB drive just because it's plugged in. You have to "mount" it, which tells Linux where to attach that device's files into the main system "tree".


πŸ”Ή Proper Shutdown

Linux uses "caching," which means it temporarily stores data in its fast memory before writing it to the slow disk.

Because of this, you should never just flip the power switch off.

You must use a shutdown command to ensure that all data is safely saved to the disk first.


πŸ“ Why Is There a Standard?

In the early days of Linux, different versions (called distributions) put files in different places, which caused anarchy and confusion.

The FSSTND (Filesystem Standard) was created to fix this.

Having a standard location for files provides several benefits:

1. πŸ‘€ For Users

  • You can find your programs even if you switch to a different version of Linux.

2. πŸ› οΈ For Administrators

  • It makes it much easier to upgrade your system.
  • Easier to get support from others.

3. πŸ‘¨β€πŸ’» For Developers

  • They can write software that works on all Linux systems because they know exactly where important tools are located.

🌐 The Reality

The standard is not perfect.

Different versions of Linux, such as:

  • Red Hat
  • Debian

still have some small differences in how they organize things.

Because of this, groups like the Linux Standard Base continue to work on making all Linux systems more consistent.


βœ… Quick Summary

πŸ“Œ Topic πŸ“ Explanation
Filesystem Organizes and tracks files
Root Directory Everything starts from /
Linux Structure Single tree hierarchy
Case Sensitivity Work β‰  work
Mounting Devices must be attached to the filesystem
Shutdown Prevents data corruption
Standards Keep Linux systems consistent

Top comments (0)