Skip to main content

Command Palette

Search for a command to run...

Linux Architecture

Published
β€’3 min read
A

DevOps engineer sharing daily learnings on Linux, Docker, Kubernetes, CI/CD, and Cloud.

If you are new to Linux, you might wonder:

πŸ‘‰ How does Linux actually work inside?
πŸ‘‰ What happens when I type a command in the terminal?

Linux architecture answers these questions. It explains how Linux is structured and how different parts work together to run your system.

Don’t worryβ€”no complex terms.

What is linux architecture ?

Linux architecture is the internal structure of the Linux operating system.
It shows how:

  • Users interact with Linux

  • Commands are processed

  • Hardware like CPU, memory, and disk are used

High-Level Linux Architecture

Linux follows a layered design, meaning each layer has a specific role.

User
 ↓
Applications & Shell
 ↓
System Calls
 ↓
Linux Kernel
 ↓
Hardware

We’ll understand each layer one by one.

  1. User Space (Applications)

User space contains:

  • Commands like ls, cp, grep

  • Applications like browsers

  • DevOps tools (Docker, kubectl)

These programs:

  • Run with limited permissions

  • Cannot directly access hardware

  • Depend on the kernel

  1. Shell (Command Line Interface)

The shell is where users type commands.

Popular shells:

  • bash

  • sh

  • zsh

Example:

ls
  1. System Call Interface

Applications cannot talk to the kernel directly.
They use system calls to request services.

Example system calls:

  • read()

  • write()

  • open()

πŸ‘‰ Simple explanation:
System calls are like a request form submitted to the kernel.

Example command:

strace ls
  1. Linux Kernel (The Heart of Linux)

The kernel is the most important part of Linux. It acts as a bridge between hardware and users.

What does the kernel do ?

πŸ”Ή Process Management

  • Starts programs

  • Stops programs

  • Decides which program uses the CPU

πŸ”Ή Memory Management

  • Allocates RAM to programs

  • Frees memory when programs stop

  • Manages swap space

πŸ”Ή File System Management

  • Handles files and folders

  • Controls file permissions

  • Manages disks

Linux file systems: ext4 , xfs , nfs

πŸ”Ή Device Management

  • Controls hardware devices

  • Uses device drivers

πŸ”Ή Network Management

  • Handles internet and networking

  • Manages IP addresses, ports, firewalls

  1. Hardware Layer

    This is the physical part of the system, such as:

    • CPU

    • RAM

    • Hard Disk / SSD

    • Network card

    • Keyboard, mouse

Linux does not allow users or applications to directly control hardware.
This keeps the system safe and stable.

πŸ“Œ Real Example: Running the ls Command

Imagine you type this in the terminal:

ls

Now let’s see how Linux architecture works step by step.

Step 1: User (You)

You are the user sitting at the computer and typing a command.

πŸ‘‰ You want to see the list of files in a directory.

Step 2: Shell

The shell (for example, bash) receives your command.

  • It checks if ls is a valid command

  • It prepares the request for the system

The shell cannot access files directly.

Step 3: System Calls

To read directory contents, the shell asks the kernel for help using system calls like:

  • open()

  • read()

Think of system calls as a legal way for programs to request services from the kernel.

Step 4: Linux Kernel

The kernel does the real work:

  • Checks if you have permission to read the directory

  • Communicates with the file system

  • Reads data from the disk

The kernel is the only part allowed to talk to hardware.

Step 5: Hardware

The disk (SSD/HDD):

  • Sends file data to the kernel

The kernel then sends this data back to the shell.

Step 6: Output to User

The shell displays the result on your screen:

file1.txt
file2.log
docs/

This Explains Linux Architecture

User β†’ Shell β†’ System Call β†’ Kernel β†’ Hardware
                                   ↓
                               Response
  • User gives instruction

  • Shell interprets it

  • Kernel manages resources

  • Hardware performs the action