Table of Contents
- Overview
- What is the Linux File Hierarchy?
- Core Directories and Their Purpose
- What is Bash
- Essential Commands and Their Functions
- Business Use Case
- Benefits of Understanding File Hierarchy
Overview
In Linux, everything even devices is treated as a file. The File System Hierarchy (FHS) is a tree-like structure starting at the root (/). Understanding it is key for sysadmins, developers, and DevOps teams.
This article explains the main directories, their roles, and useful commands to navigate them.
What is the Linux File Hierarchy
Linux uses a single-rooted, inverted tree-like file system where all files and directories stem from the root (/).
Each folder under / serves a specific purpose. Understanding these functions helps streamline system navigation, automation, and troubleshooting.
Core Directories and Their Purpose
Of course! Here's the cleaned-up version of your Linux core directories table without examples:
Directory | Purpose |
---|---|
/ |
Root of the file system; the starting point. |
/root |
Home directory for the root (superuser). |
/bin |
Essential binary commands. |
/sbin |
System administration binaries. |
/etc |
Configuration files for services and applications. |
/home |
User home directories. |
/dev |
Device files. |
/var |
Variable data such as logs and cache. |
/proc |
Runtime system process information. |
/usr |
User-level applications and binaries. |
/opt |
Optional third-party applications. |
/mnt |
Temporary mount point for external file systems. |
/media |
Auto-mounted removable media. |
What is Bash?
Bash (Bourne Again SHell) is the default command-line interpreter in most Linux systems. It lets you run commands, scripts, and automate tasks — like a more powerful version of Windows Command Prompt.
Here is the Windows command prompt interface.
Essential Commands and Functions
pwd
Prints current working directory.
ls
Lists files and folders in the current directory.|
clear
Clears the terminal screen.
uname
Shows operating system name.
uname -r
Displays kernel version.
whoami
Displays current user.
date
Displays current date and time.
history
Lists command history.
Business Use Case
Let’s say you're setting up a web server in a cloud environment using AWS or Azure. You'll likely:
Store config files in /etc/nginx/
Serve web pages from /var/www/html
Monitor logs in /var/log/nginx/access.log
Install optional tools in /opt
For Security Teams
Understanding /proc, /dev, and /var/log is critical for:
- Monitoring running processes
- Identifying hardware vulnerabilities
- Reviewing audit and access logs
dev
proc
/usr
sbin
media
Benefits of Understanding File Hierarchy
- Efficient Navigation: Jump between directories without guesswork
- Troubleshooting: Easily locate logs and configurations
- Automation: Write cleaner Bash scripts with proper pathing
- Security: Manage user access based on directory structures
- Compliance: Ensure data, logs, and access controls follow best practices
Learning Linux File Hierarchy is like learning the layout of a building before doing maintenance. You’ll be faster, more efficient, and more confident in managing systems.
Top comments (0)