Linux File System Hierarchy: Place and Find Data Correctly
The Linux directory hierarchy gives administrators conventions for locating configuration, programs, persistent state and temporary data. Start at a process's root directory, then distinguish the purpose of each path and the filesystem mounted there. Modern systems may use compatibility links such as bin pointing into usr, and distributions do not implement every historical layout identically.
Topic: Linux Administration in IT Infrastructure · Explainer
Learning path: Linux to RHCSA, lesson 2 of 23
Quick answer: The Linux directory hierarchy gives administrators conventions for locating configuration, programs, persistent state and temporary data. Start at a process's root directory, then distinguish the purpose of each path and the filesystem mounted there. Modern systems may use compatibility links such as bin pointing into usr, and distributions do not implement every historical layout identically. A service-data example shows how these distinctions help with backup, recovery and troubleshooting without moving or deleting actual files.
Key takeaways
- Separate a directory path from the filesystem mounted there.
- Identify configuration, persistent state and temporary data separately.
- Expect distribution-specific layout and compatibility links.
- Treat proc and sys as interfaces, not ordinary backup data.
- Check mounts and access before diagnosing a missing file.
Table of Contents
- What does the root directory mean?
- Which locations should a beginner recognise first?
- Why might bin and sbin be symbolic links?
- Why are proc and sys different from ordinary directories?
- What can a mount change about a familiar path?
- How should temporary and personal data be handled?
- How can learners practise the hierarchy without changing a system?
- References
What does the root directory mean?
An absolute path starts from the calling process's root; a relative path starts from its current working context. The Linux pathname-resolution reference also explains why processes can have different roots or mount namespaces. A path that exists in a host view may therefore be absent or different inside a container.
Consider an illustrative report service with configuration, a queue and a generated summary. The operator records the paths as the service sees them, alongside the deployment context. This is more precise than saying that every process on a machine always sees one identical tree. It also prevents a common troubleshooting mistake: checking a familiar host directory while the application is using a different mounted view.
Which locations should a beginner recognise first?
Learn the purpose of locations before memorising every directory name. The UAPI Linux hierarchy specification distinguishes administrator configuration, vendor resources, persistent variable state and runtime data. It documents a modern layout; older Filesystem Hierarchy Standard conventions and distribution-specific choices still matter when reading existing systems.
For the report service, the deployment documentation might place machine configuration under etc, persistent application state under var/lib and runtime information under run. These are planning examples, not instructions to move an installed application. Check the package and service documentation for its actual layout. Backups and recovery depend on those actual choices, not only on what a general directory chart suggests.
| Purpose | Typical location | Operational question |
|---|---|---|
| Machine configuration | /etc | Which local settings must recovery preserve? |
| Persistent service state | /var/lib | What application data must survive replacement? |
| Runtime state | /run | What should the service recreate after boot? |
| Vendor resources | /usr | Which package or image supplies this content? |
Why might bin and sbin be symbolic links?
Modern distributions can consolidate executable and library locations under usr while retaining compatibility links. Consult the systemd hierarchy reference and the selected distribution's documentation. Seeing a bin path does not establish that the program's content is physically stored in an independent directory.
Likewise, an sbin location does not prove that every operation performed by every program there requires root. The requested operation and its access checks determine authority. In the service example, the operator records both the documented executable path and any relevant resolved location. Avoid manually rearranging these paths to make a machine resemble an older diagram; package and boot assumptions can depend on the supported layout.
Why are proc and sys different from ordinary directories?
The kernel's proc filesystem documentation describes interfaces to process and system information. Some paths expose changing observations, while others can affect runtime parameters. They are not simply a set of static disk files to archive and later restore as application data.
The sysfs documentation describes exporting kernel objects and attributes to user space. Some attributes are writable controls. A learner should not assume that writing to something presented as a file is harmless. For the report service's recovery inventory, distinguish its persistent queue from information exposed through these kernel interfaces. Review approved read-only observations separately from any proposed system-setting change.
| Path kind | How to interpret it | Backup or recovery implication |
|---|---|---|
| Persistent queue | Application state in its documented storage. | Use the service's consistent backup procedure. |
| Process information | A changing view exposed by the kernel. | Preserve relevant observations, not a blind directory copy. |
| Device attribute | Kernel interface with documented semantics. | Do not replay arbitrary writes during restoration. |
What can a mount change about a familiar path?
A directory can act as a mount point for another filesystem. Its visible content then depends on what is mounted in that process's view. A missing mount can make an expected directory appear empty, while a failed storage dependency can prevent a service from finding its state. Avoid concluding that files were deleted from one observation alone.
In the example, a queue expected on separate storage is unavailable after maintenance. The operator checks the approved deployment description and mount evidence before recreating a directory or restoring data into the wrong place. A path is an address in a hierarchy, not a guarantee about the underlying disk, remote storage, persistence or available capacity.
How should temporary and personal data be handled?
Temporary locations have cleanup and persistence rules that depend on the location and system policy. Never use tmp as an undocumented permanent backup. User preferences and state may also live in different locations. The XDG Base Directory Specification separates configuration, data, cache and state for applications that follow it.
For the report service, classify a regenerable preview separately from a pending report request. Losing a cache might be inconvenient, while losing an unprocessed request could affect business work. The name temporary does not establish that a file is safe to delete now. Check ownership, active use and the application's procedure before any cleanup, and use invented examples for initial practice.
How can learners practise the hierarchy without changing a system?
Draw four cards: a service setting, a persistent queue item, a disposable preview and a runtime socket. Match each to a purpose and a documented location for a chosen fictional deployment. Then ask what must be retained when the operating-system image is replaced and what the service should recreate.
Add a final variation: the service runs inside a container with its queue mounted from elsewhere. Identify which path the application uses and which storage the operator must protect. Keep unresolved placement or retention questions in the design note. This exercise helps a learner reason about persistence and recovery while leaving the actual host's files, mounts and permissions unchanged.
Related reading: Reason about access to a path; Follow a program through Linux.
If you want instructor feedback, ask WebAsha for a syllabus, supervised lab arrangements and written access terms before enrolling.
References
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0