Two-Level Directory Structure
What You'll Learn
You'll learn how giving each user their own directory solves naming conflicts but creates challenges for sharing files.
The Problem with Single-Level Directories
In a single-level directory, all files lived in one flat namespace. With multiple users, this created chaos—if both Alice and Bob wanted to name a file report.txt, they'd clash. One would overwrite the other's work.
How Two-Level Directories Work
A two-level directory structure gives each user their own private directory. Think of it like an apartment building: the building has a main entrance (the root), and each tenant has their own apartment (user directory). Inside their apartment, they can name their belongings however they want without conflicting with neighbors.
The structure looks like:
Root
├── User: Alice
│ ├── report.txt
│ └── notes.txt
└── User: Bob
├── report.txt
└── data.csv
Now Alice and Bob can both have report.txt without collision—the full path distinguishes them: /alice/report.txt vs /bob/report.txt.
The Trade-off: Limited Sharing
This solves the naming conflict problem beautifully. Each user has isolation and freedom within their own space.
But here's the catch: sharing becomes difficult. If Alice wants to collaborate with Bob on a shared project file, where does it live? In Alice's directory? Bob's? If it's in Alice's directory, Bob must specify /alice/shared_project.txt—but what if Alice moves or deletes it? There's no natural "common space" for collaborative work.
Two-level directories treat users as isolated islands, which is great for independence but awkward for teamwork.
Key Takeaway: Two-level directories solve per-user naming conflicts by giving each user an isolated namespace, but they make file sharing between users cumbersome since there's no built-in mechanism for common shared spaces.