Skip to main content

Command Palette

Search for a command to run...

Day 02 – Understanding Linux Architecture, Processes, and systemd

Updated
β€’3 min read

πŸš€ Introduction

Today I learned what happens inside Linux instead of just running commands blindly.

Linux may seem complicated at first, but when we understand how its parts connect, everything starts making sense.

Linux works in layers, and each layer has a role.


🧩 Linux Architecture (How Everything Connects)

Think of Linux like a company structure.

LayerRoleExample
HardwarePhysical componentsCPU, RAM, Disk
KernelBrain of the systemManages memory & CPU
ShellInterface between user and kernelTerminal (bash)
ApplicationsPrograms that do workNginx, MySQL

πŸ”— How They Work Together

When you type a command like:

ls

This happens behind the scenes:

User β†’ Shell β†’ Kernel β†’ Hardware β†’ Result back to user

The shell sends the request, but the kernel actually talks to the hardware.


βš™οΈ What is a Process?

A process is simply a running program.

Example:
When you start a web server:

systemctl start nginx

Linux creates a process for Nginx.

You can see running processes using:

ps aux
top

Each process has:

  • PID (Process ID)

  • CPU usage

  • Memory usage

  • State


πŸ”„ Process States (Easy Meaning)

StateMeaningExample
RunningUsing CPUA script executing
SleepingWaitingNginx waiting for request
StoppedPausedProcess stopped manually
ZombieFinished but not cleanedRare system leftover

Most processes are usually sleeping, not actively running.


πŸ‘¨β€πŸ’Ό What is systemd?

When Linux boots, one of the first important programs that starts is systemd.

systemd is the service manager of Linux.

It is responsible for:

  • Starting services at boot

  • Stopping services

  • Restarting services if they crash

  • Managing service logs


πŸ”§ Important systemd Commands

systemctl start nginx      # Start a service
systemctl stop nginx       # Stop a service
systemctl restart nginx    # Restart a service
systemctl status nginx     # Check service status
systemctl enable nginx     # Start service on boot
systemctl disable nginx    # Disable service at boot
journalctl -u nginx        # View logs of a service

🧠 Real DevOps Example

If a website goes down:

1️⃣ Check service status

systemctl status nginx

2️⃣ Restart service

systemctl restart nginx

3️⃣ Check error logs

journalctl -u nginx

🧠 Big Picture (How Everything Works Together)

Let’s say a user opens a website hosted on your server:

1️⃣ Nginx process receives the request
2️⃣ Process asks kernel for CPU & memory
3️⃣ Kernel talks to hardware
4️⃣ systemd ensures Nginx keeps running

If Nginx crashes β†’ systemd can restart it automatically.


πŸ›  5 Daily Linux Commands

ps aux                  # Show all processes
top                     # Live process monitoring
htop                    # Better system monitor
kill <PID>              # Stop a process
systemctl status nginx  # Check service health

🎯 Why This Matters for DevOps

Understanding Linux internals helps you:

βœ” Fix crashed services
βœ” Troubleshoot CPU/memory issues
βœ” Understand logs
βœ” Debug production problems faster

Linux knowledge = Strong DevOps foundation.


See you on Day 03 – Linux File System πŸš€