Linux & Commands

The Kernel
& The Shell

Linux is the backbone of the internet, cloud computing, and supercomputers. It is a Unix-like operating system that gives users direct control over hardware through powerful command-line tools.

00 / The Origin

A Hobby that Changed the World

Before Linux, there was Unix. Developed in 1969 at AT&T Bell Labs by Ken Thompson, Dennis Ritchie, and others, Unix was a revolutionary operating system designed for multi-user multitasking. It introduced key software design philosophies like "everything is a file" and modular pipeline utilities. Because Unix became commercialized, proprietary, and highly expensive, it motivated developers to build open-source alternatives.

In 1991, a Finnish student named Linus Torvalds announced a "hobby" project: a free operating system kernel. He wanted a Unix-like system similar to Minix (an educational microkernel Unix) but for his 386 personal computer.

"I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones..."
— Linus Torvalds, comp.os.minix, 1991

This project combined with the GNU Project (started by Richard Stallman to create free software tools) to form the complete GNU/Linux operating system. Today, Linux runs everything from the world's top 500 supercomputers to the Android phone in your pocket.

MINIX: The Microkernel Inspiration

MINIX (Mini-Unix) is a Unix-like computer operating system based on a microkernel architecture, created by Professor Andrew Tanenbaum in 1987 for educational purposes. Unlike Linux's monolithic kernel design, MINIX keeps the kernel minimal, running drivers and filesystems as separate, isolated user-space processes.

Linus Torvalds used MINIX to learn operating system development but created Linux because MINIX originally had licensing restrictions and lacked support for key hardware features of his new Intel 386 computer. This famously led to the Tanenbaum-Torvalds debate on Usenet in 1992, arguing the merits of microkernels vs. monolithic kernels.

01 / Architecture

Understanding the Beast

Before typing commands, it helps to know what you are actually talking to. Linux isn't just one program; it's a layered system.

Layers of Abstraction

Hover over the diagram to explore the system layers.

  • User: You & your applications.
  • Shell: The command interpreter.
  • Kernel: Core OS & Resource Management.
  • Hardware: The physical machine.

The Filesystem Hierarchy

Unlike Windows (C:\, D:\), Linux has a single tree starting at root /.

/ The Root. Start of everything.
/bin Essential command binaries (ls, cp, cat).
/home User directories (like C:\Users).
/etc Configuration files (network settings, user lists).
/var Variable files (logs, temp files).
01.b / Ecosystem

Linux OS Families (Distributions)

Linux is just a kernel. To make it a usable operating system, developers bundle it with system utilities, package managers, and software. These packages are called Distributions (or "Distros"). Different distros target different use cases.

Debian Family (Parent)

Debian

Known as the "universal operating system," Debian is a massive community-led project prioritizing absolute stability and free software philosophy.

  • Package Manager: apt / dpkg (.deb)
  • Primary Use: Rock-solid web servers, infrastructure foundations, upstream base for Ubuntu.
  • Core Strength: High security, exceptional reliability, and huge package repository.
Stable / Foundation
Debian Family (Downstream)

Ubuntu

Built on top of Debian's testing branch. Focuses on polished user experience, developer ease, and commercial backing (Canonical).

  • Package Manager: apt / snap
  • Primary Use: Personal laptops, cloud servers, machine learning workstations, CI/CD pipelines.
  • Core Strength: Extensive community help, easy driver installation, and widespread cloud support.
Standard / Production
Debian Family (Specialized)

Kali Linux

A specialized distribution derived from Debian, tailored specifically for security professionals and ethical hackers.

  • Package Manager: apt / dpkg
  • Primary Use: Penetration testing, security auditing, digital forensics, reverse engineering.
  • Core Strength: Pre-installed with hundreds of specialized tools (Nmap, Wireshark, Metasploit).
Security / Pentesting
Red Hat Family

RHEL / Fedora

Built for enterprise environments requiring strict security, compliance, and support.

  • Package Manager: dnf / rpm
  • Primary Use: Enterprise server infrastructure, corporate workstations.
  • Core Strength: Commercial support, SELinux security integration, long-term stability.
Enterprise / Workstation
Independent

Arch Linux

Designed for power users who want complete control over their operating system configuration.

  • Package Manager: pacman (with AUR support)
  • Primary Use: Developer workstations, gaming rigs, custom setups.
  • Core Strength: Rolling release model (always up-to-date), extreme DIY customizability.
Power User / Bleeding Edge
Minimalist

Alpine Linux

An ultra-lightweight, security-oriented distribution designed for modern cloud container workloads.

  • Package Manager: apk
  • Primary Use: Docker containers, microservices, embedded systems.
  • Core Strength: Tiny footprint (~5MB base size), fast startup, and reduced attack surface.
Containers / Minimalist
02 / Navigation

Filesystem Navigation

Moving through the directory tree. In Linux, everything starts from root (/).

Essential commands for orienting yourself in the hierarchy.

# Print Working Directory - Where am I? $pwd
/home/user/projects

# List files - What is here? # -l: long format, -a: all files (hidden), -h: human readable sizes $ls -lah

# Change Directory - Go somewhere else $cd /var/log // Go to absolute path $cd .. // Go up one level $cd ~ // Go to home directory
02 / Manipulation

File Operations

Creating, moving, copying, and destroying files.

# Create an empty file $touch newfile.txt

# Make a directory (and parents if needed) $mkdir -p project/src/assets

# Copy files # -r: recursive (for directories) $cp -r source_folder backup_folder

# Move or Rename files $mv oldname.txt newname.txt

# Remove files (Careful!) # -rf: recursive and force (No confirmation) $rm -rf junk_folder
02 / Archives

Archiving & Compression

# Tar - Tape Archive (Standard Linux format) # c: create, v: verbose, f: file, z: gzip compression $tar -cvzf backup.tar.gz /home/user/project

# Extract Tarball # x: extract $tar -xvzf backup.tar.gz

# Zip / Unzip $zip -r static.zip static/ $unzip static.zip
03 / System & Security

Permissions & Ownership

Linux is multi-user. Every file has read (r), write (w), and execute (x) permissions for User, Group, and Others.

User (u) rwx
Group (g) r-x
Others (o) r--
# Change Mode (Permissions) # 755: u=rwx (4+2+1), g=rx (4+1), o=rx (4+1) $chmod 755 script.sh

# Add execute permission for everyone $chmod +x run.sh

# Change Owner # user:group $chown human:undrstanding file.txt
03 / Insights

System Information

# Kernel & System Info $uname -a

# Disk Usage (Free space) # -h: human readable (GB/MB) $df -h

# Directory Space Usage $du -sh node_modules/

# Memory (RAM) Usage $free -h

# System Uptime $uptime
03 / Runtime

Process Management

# Task Manager (Real-time) $top

# Snapshot of current processes $ps aux | grep node

# Kill a process by PID $kill 1234

# Force kill $kill -9 1234
04 / Communication

Networking

# Check connectivity (Ping) $ping -c 4 google.com

# IP Address Configuration (Modern way) $ip addr show

# Network Statistics (Ports listening) # -t: tcp, -u: udp, -l: listening, -p: program name $netstat -tulpn # or 'ss -tulpn'

# Secure Shell (SSH) $ssh -i key.pem user@server.com

# File Transfer over SSH (SCP) $scp file.txt user@server.com:/var/www

# HTTP Requests $curl -I https://google.com $wget https://example.com/file.zip
04 / Pipes

Input/Output Redirection

The Unix Philosophy

Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.

# Output Redirection (Overwrite) $echo "Hello World" > hello.txt

# Output Redirection (Append) $echo "Another line" >> hello.txt

# The Pipe (|) - Connect output of one to input of next # Count lines in files containing "error" $grep "error" server.log | wc -l

Pipeline Visualization

Green = Info (Ignored), Red = Error (Passed through grep)

Glossary

Key Definitions

Linux

A free, open-source operating system kernel created by Linus Torvalds.

Kernel

The core component of an OS that manages hardware and system resources.

Shell

A program that takes commands from the keyboard and gives them to the OS to perform.

Root (/)

The top-level directory of the Linux filesystem hierarchy.

Sudo

"SuperUser DO". A command that allows a permitted user to execute a command as the superuser.

Permissions

Rights given to users and groups to read, write, or execute files.

Process

An instance of a running program.

SSH (Secure Shell)

A protocol for operating network services securely over an unsecured network.

Pipe (|)

A mechanism for inter-process communication, taking the output of one process and using it as input for another.

Daemon

A background process that answers requests for services.

05 / Assessment

Knowledge Check