Iftekhar EatherTechnical Lead · System Architecture · Cloud
Back to Blog
#linux#guide#kernel#linuxtutorial

Part 1: Linux Foundations & Getting Setup

To truly master Linux, you must establish a precise mental model, moving beyond simple command familiarity to understand the architecture stack. This knowledge-sharing journey begins not with commands, but with a foundational breakdown of how the OS operates and how to rapidly deploy a workspace for hands-on learning.

Iftekhar Ahmed Eather4 min read
Part 1: Linux Foundations & Getting Setup

01: What Linux Actually Is

When engineers refer to "Linux", they are describing an operating system ecosystem built around two critical layers:

  • The Linux Kernel: The fundamental core of the OS. It is the only layer that interacts directly with your physical or virtual hardware—managing processes (CPU scheduling), memory allocation, filesystems, and network communication.

  • User-Space Tools & Utilities: The environment surrounding the kernel. This includes command shells (Bash, Zsh), standard utility libraries, and user software tools (e.g., ls, grep, systemctl) that let you execute instructions on the system.

The Layers of a Linux System

Visualizing a Linux machine as a stack of functional layers provides clarity when troubleshooting system issues:

  • User Applications: Web servers (nginx), databases, Docker, and developer tools sitting at the top.

  • Shell & User Interfaces: Command interpreters that convert typed input into system instructions.

  • System Libraries & Utilities: Interface layers (such as glibc) providing standardized functions to access kernel features.

  • Linux Kernel: The central manager managing system resources.

  • Hardware: The underlying physical or virtual components (CPU, RAM, Disks, Network Interfaces).

A distribution, or "distro", packages the core upstream Linux kernel with custom package managers, system utilities, and sensible default configurations:

Distro Family

Characteristics & Primary Focus

Examples

Ubuntu / Debian

User-friendly, extensive package ecosystems, standard for server deployments.

Ubuntu, Debian

RHEL / Enterprise

Enterprise-grade stability. Features land in Fedora before heading to stable distributions.

RHEL, Rocky Linux, AlmaLinux, Fedora

Minimal / Special

Lightweight containers (Alpine), full-control rolling releases (Arch), or security auditing (Kali).

Alpine, Arch Linux, Kali Linux

02: Getting Set Up (Fast)

Hands-on terminal practice is essential for building muscle memory.

Instead of configuring complex virtual machine managers or dual-booting, you can spin up a lightweight, isolated Linux terminal container in seconds using Docker.

Launching a Dev Container

Execute the following command in your terminal (PowerShell for Windows, or native terminal on macOS/Linux) to start a persistent Ubuntu dev environment:

Windows (PowerShell):

docker run -dit 
  --name ubuntu-dev 
  --hostname ubuntu-node 
  --restart unless-stopped 
  --cpus="2" 
  --memory="4g" 
  --mount type=bind,source="C:/Users/youruser/Downloads/ubuntu-data",target=/data 
  -p 2222:22 
  -p 8080:80 `
  ubuntu:latest /bin/bash

macOS / Linux:

docker run -dit \
  --name ubuntu-dev \
  --hostname ubuntu-node \
  --restart unless-stopped \
  --cpus="2" \
  --memory="4g" \
  --mount type=bind,source=/tmp/ubuntu-data,target=/data \
  -p 2222:22 \
  -p 8080:80 \
  ubuntu:latest /bin/bash

Detailed Breakdown of Docker Container Flags

  • -dit: Combines three interactive flags:

    • -d (Detached): Runs the container in the background, freeing up your terminal prompt.

    • -i (Interactive): Keeps STDIN (standard input) open so you can send commands to the container.

    • -t (TTY): Allocates a pseudo-TTY (terminal emulator) inside the container.

  • --name ubuntu-dev: Assigns a custom, human-readable name (ubuntu-dev) to the container for easy management (docker stop ubuntu-dev) instead of relying on randomly generated IDs.

  • --hostname ubuntu-node: Sets the internal hostname seen inside the container prompt (e.g., root@ubuntu-node:~#).

  • --restart unless-stopped: Automatically restarts the container if it crashes or if the host machine reboots, unless you manually execute docker stop.

  • --cpus="2": Restricts the container to a maximum of 2 CPU cores on your host system.

  • --memory="4g": Limits the container’s RAM usage to 4 Gigabytes.

  • --mount type=bind,source=...,target=/data: Performs a bind-mount mapping a host folder (source) to /data (target) inside the container so files persist even if the container is destroyed.

  • -p 2222:22: Maps host port 2222 to container port 22 (SSH).

  • -p 8080:80: Maps host port 8080 to container port 80 (HTTP web traffic).

  • ubuntu:latest /bin/bash: Specifies the base image (ubuntu:latest) and overrides the default entry command to open an interactive Bash shell (/bin/bash).

03: Package Management Basics

Package managers automate the safe installation, updating, configuration, and removal of software dependencies. They fetch verified binaries from official remote repositories.

Daily Package Commands across Distros

Distro Family

Package Manager

Refresh Repositories

Install Package

Clean Dependencies

Debian / Ubuntu

apt

sudo apt update

sudo apt install nginx

sudo apt autoremove

RHEL / Fedora

dnf

sudo dnf check-update

sudo dnf install nginx

sudo dnf autoremove

Arch Linux

pacman

sudo pacman -Sy

sudo pacman -S nginx

sudo pacman -Rns

Pro Tip: Always run repository updates before installing new software: sudo apt update && sudo apt upgrade -y.