In Part 1, I shared how I started my DevOps journey with Linux basics and simple file operations (CRUD). One thing quickly became clear: commands like cd and ls are useful, but they donโt mean much if you donโt understand where you are in the Linux file system.
In the real IT world, knowing where configs live, where logs are stored, and where user files belong is critical. Thatโs where the Linux File System Hierarchy comes in โ itโs basically the map of the entire operating system.
๐ก Why the File System Hierarchy Matters in DevOps
Think of it like this:
A developer pushes code โ it runs on a server.
If the app crashes, you need to check logs.
If you want to tweak behavior, you need to edit configs.
If permissions break, you need to manage users.
All of this happens inside the Linux file system hierarchy. Without knowing the map, youโre just wandering around blindly.
๐ Key Directories (with Real-World Use Cases)
Hereโs what I learned while exploring:
/ โ The Root
The starting point of everything in Linux.
Every file and directory originates here.
๐ Like the โC:\โ drive in Windows.
/home โ User Workspaces
Contains personal directories for each user.
Example: /home/sheersh would be my workspace.
๐ In DevOps teams, developers often store project files here during testing.
/etc โ Configuration Files
Stores system-wide config files.
Example: /etc/ssh/sshd_config controls SSH access.
Example: /etc/nginx/nginx.conf holds Nginx server configs.
๐ This is where IT engineers spend a lot of time fine-tuning deployments.
/var/log โ Logs
Contains log files for the system and apps.
Example: /var/log/syslog, /var/log/nginx/error.log.
๐ In real DevOps, if an app crashes, this is the first place you look.
/usr โ User Programs and Libraries
Stores installed software and libraries.
Example: /usr/bin has common commands like python3.
๐ When deploying, youโll often check here to verify if required packages are installed.
/bin & /sbin โ Essential Commands
/bin โ essential user commands (e.g., ls, cp, mv).
/sbin โ system admin commands (e.g., reboot, shutdown).
๐ Think of these as the toolbox for admins and users.
/opt โ Optional Software
Holds third-party or custom software.
๐ If you install a monitoring tool or DevOps agent, you may find it here.
๐ง Challenges I Faced (and How I Solved Them)
1๏ธโฃ Where Are the Configs?
At first, I couldnโt figure out where servers like Nginx or SSH stored their configs.
Problem: Kept searching randomly.
Solution: Learned that almost all configs live under /etc.
๐ Lesson: /etc is the control center.
2๏ธโฃ Where Are the Logs?
When my system behaved oddly, I didnโt know where to check.
Problem: Googling errors instead of finding logs.
Solution: Discovered /var/log and learned journalctl on systemd systems.
๐ Lesson: /var/log and journalctl together tell the systemโs story.
3๏ธโฃ Permissions Confusion
I edited files in /etc and kept seeing โPermission denied.โ
Problem: Tried using normal user privileges.
Solution: Learned to use sudo for admin-level changes.
๐ Lesson: In real DevOps teams, not everyone is root โ permissions protect systems.
๐ How to See System Logs (Old vs Modern Way)
On Linux, there are multiple ways to view system logs depending on what you want to check. Over time, this has evolved โ earlier systems relied mainly on plain text files like /var/log/syslog, while modern Linux distributions use systemd with journalctl. Knowing both is important, because in real IT environments, youโll come across both setups.
1) journalctl โ Modern Way (systemd-based systems like Ubuntu, Fedora, CentOS 7+)
systemd manages logs in a binary journal format, and you use journalctl to read them:
journalctl # Shows all logs managed by systemd-journald
journalctl -xe # Shows recent logs with details (errors/warnings)
journalctl -u sshd # Logs for a specific service (e.g., sshd)
journalctl -f # Follow logs in real-time (like tail -f)
๐ On most modern distros, this is the go-to tool for system logs.
2) /var/log/ โ Traditional Way (used earlier, still relevant)
Before systemd, logs were written directly into plain text files under /var/log/. Many apps still log here, so itโs essential to know:
ls /var/log/
Common files:
/var/log/syslog -> General system messages (Ubuntu/Debian)
/var/log/messages -> General system messages (RHEL/CentOS)
/var/log/auth.log -> Authentication (logins, sudo)
/var/log/kern.log -> Kernel messages
/var/log/dmesg -> Boot & hardware messages
Example commands:
cat /var/log/syslog
tail -f /var/log/syslog # See logs live
๐ Note: On older guides/tutorials, youโll see a lot of /var/log/syslog. On modern systems, that role is now mostly handled by journalctl, but /var/log is still widely used for app-specific logs.
3) dmesg for Kernel/Boot Messages
dmesg prints messages from the kernel ring buffer โ useful for drivers, boot, and hardware troubleshooting:
dmesg | less
โ ๏ธ A Real Mistake I Made
I once tried to open system.journal directly with cat:
cat /var/log/journal/<machine-id>/system.journal
The output was pure gibberish ๐ โ because system.journal is a binary file.
๐ The correct way is always:
journalctl
That lesson taught me something crucial: syslog was used earlier, journalctl is used now โ and knowing both makes you flexible across systems.
๐ Hands-On Mini Demo (Logs + Navigation)
Hereโs a small sequence that ties the file-system map to log-checking โ exactly what I do when I SSH into a server:
# Navigate to configs
cd /etc
ls
cat ssh/sshd_config # view SSH config
# Check system logs (systemd)
journalctl -xe
# Kernel boot messages
dmesg | less
๐ Key Takeaways from Part 2
The Linux file system is a map โ /etc for configs, /var/log (and journalctl) for logs, /home for user work.
Syslog was used earlier; journalctl is now the standard, but /var/log is still very relevant.
Small mistakes (like cat-ing a binary journal file) teach you tools and patterns that matter in production.
Practicing navigation + log checks is the closest thing to real server troubleshooting.
๐ Whatโs Next (Part 3)
In Part 3, Iโll dive into Linux Users and Permissions โ because in real teams, managing who can do what on a server is just as important as knowing where files live.
๐ค Over to You
Have you ever tried to cat a binary log or been surprised by journalctl output? Share your โoopsโ and โahaโ moments โ I learn best from othersโ mistakes too. ๐
Top comments (0)