Skip to main content

Command Palette

Search for a command to run...

Linux File System Hunting

Published
4 min read
Linux File System Hunting
S

Learning web development in public. Writing simple, real-world explanations about web development concepts. Helping beginners understand why things work, not just how.

When I first started using Linux, it felt very simple.

Type a command → press enter → get output.

But during this assignment, my thinking changed.

Instead of asking:
“What command should I run?”

I started asking:
“What is actually happening inside the system when I run this?”

That small shift completely changed how I understand Linux.


Linux is Not a Black Box

Earlier, I treated Linux like a black box.

Now I see it differently.

Linux does not hide things. It exposes almost everything through files.

Processes, networking, users, hardware, system behavior — everything is visible if you know where to look.


/etc — Where System Rules Live

At first, /etc looked like a random directory.

But when I explored it:

cat /etc/hosts
cat /etc/resolv.conf
cat /etc/passwd

I realized something important:

/etc is where Linux stores its rules.

Examples:

  • /etc/hosts maps domains to IP addresses

  • /etc/resolv.conf defines DNS servers

  • /etc/passwd stores user information

These are not passive files.

They are actively used by the system.

If you change them, system behavior changes.

So Linux is not fixed. It is configurable.


DNS — What Happens When You Open a Website

When you type a domain like google.com, the system needs an IP address.

Flow:

  1. System reads /etc/resolv.conf

  2. Contacts DNS server

  3. Gets IP address

  4. Starts connection

Important observation:

If DNS is misconfigured:

  • Internet appears broken

  • But the issue is only name resolution

Many network problems are actually DNS problems.


Routing — How Data Finds Its Path

After getting an IP, the system must decide where to send data.

This is handled by routing.

cat /proc/net/route

Routing table defines:

  • destination

  • gateway

  • interface

Flow:

  • Application sends request

  • Kernel checks routing table

  • Kernel decides path

Applications do not control routing. The kernel does.


/proc — Live System Data

This was the most interesting part.

echo $$
ls /proc/$$
cat /proc/meminfo
cat /proc/cpuinfo

At first, /proc looks like a normal directory.

But it is not.

It is created dynamically by the kernel.

There are no real files stored on disk.

What it provides:

  • Real-time system information

  • Process-specific data

  • Instant updates

When you read /proc, you are reading live kernel data.


/dev — Hardware as Files

In Linux, hardware is also represented as files.

ls /dev
echo "hello" > /dev/null

Examples:

  • disks

  • input devices

  • system devices

Special case:

  • /dev/null discards all data written to it

Linux follows one core idea:

Everything is treated as a file.

This simplifies how the system interacts with hardware.


Users — Simple and Transparent

cat /etc/passwd

This file contains:

  • username

  • user ID

  • home directory

Passwords are stored separately in /etc/shadow.

Linux stores user data in structured files instead of hiding it.


Permissions — Built-in Security

ls -l file.txt
chmod 000 file.txt
cat file.txt

Result: access denied.

Reason:

The kernel checks permissions before allowing access.

Commands do not enforce security. The kernel does.


Services — Background System Operations

systemctl status
ls /etc/systemd

Observations:

  • Services run in the background

  • They start automatically

  • They are controlled through configuration

Linux systems are structured. Nothing runs randomly.


Boot Process — Where Everything Starts

ls /boot

Contains:

  • kernel

  • bootloader files

Boot flow:

  1. Bootloader loads kernel

  2. Kernel initializes system

  3. Services start

This is the starting point of the system.


Final Understanding

Everything connects like this:

Command → Kernel → File System → Hardware

Each part has a role:

  • /etc controls behavior

  • /proc shows system state

  • /dev connects hardware

  • /var/log records activity


Conclusion

Earlier:

Linux = commands

Now:

Linux = a transparent, structured system

The key realization:

Linux does not hide complexity.

It organizes it in a way that can be explored and understood.

Once you understand this structure, Linux becomes logical and much easier to work with.