Linux is a free, open-source operating system kernel — the core software that manages your hardware and lets programs run. When people say "Linux", they usually mean a complete operating system built around that kernel: a Linux distribution (or "distro") that bundles the kernel with tools, libraries, and a desktop or server environment.
Linux powers 96% of the world's web servers, all of the top 500 supercomputers, Android phones, cloud platforms (AWS, Google Cloud, Azure all run Linux underneath), and the International Space Station. If the internet has a default operating system, it's Linux.
Linux in 30 seconds
| Concept | What it means |
|---|---|
| Kernel | The core of Linux — manages CPU, memory, devices |
| Distribution (distro) | Linux kernel + tools packaged together (Ubuntu, Debian, Fedora…) |
| Shell | Command-line interface to talk to Linux (bash, zsh) |
| Terminal | App that runs a shell |
| Package manager | Installs software (apt, dnf, pacman) |
| Root | The all-powerful administrator account (sudo) |
| Filesystem | Everything is a file — even hardware devices |
# Update package list and upgrade software
sudo apt update && sudo apt upgrade -y
# Check what Linux you're running
uname -a
cat /etc/os-release
# See disk usage
df -h
# See running processes
top
A brief history of Linux
| Year | Event |
|---|---|
| 1969 | Unix created at Bell Labs by Ken Thompson & Dennis Ritchie |
| 1983 | GNU Project started by Richard Stallman — free Unix-like tools |
| 1991 | Linus Torvalds releases Linux kernel 0.01 (a hobby project) |
| 1992 | Linux released under GPL license — open source forever |
| 1994 | Linux 1.0 released — production-ready |
| 2004 | Ubuntu launched — made Linux accessible to everyday users |
| 2007 | Android (Linux-based) ships on first phones |
| 2011 | Linux powers majority of the world's web servers |
| 2016 | Windows Subsystem for Linux (WSL) — Linux inside Windows |
| 2022 | Linux kernel 6.x — used on billions of devices |
Linus Torvalds famously wrote his first kernel while a 21-year-old computer science student in Finland. He posted it to an online newsgroup with: "I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu)." It became the most widely deployed OS kernel in history.
How Linux works
The architecture stack
┌─────────────────────────────────────┐
│ User Applications │ browsers, editors, servers
├─────────────────────────────────────┤
│ System Libraries │ glibc, libssl, libpthread
├─────────────────────────────────────┤
│ System Calls │ open(), read(), write(), fork()
├─────────────────────────────────────┤
│ Linux Kernel │ process management, memory,
│ (scheduler, VFS, networking, │ device drivers, filesystem
│ device drivers, security) │
├─────────────────────────────────────┤
│ Hardware │ CPU, RAM, disk, network card
└─────────────────────────────────────┘
Key kernel responsibilities
| Subsystem | What it does |
|---|---|
| Process scheduler | Decides which program runs on which CPU core and when |
| Memory manager | Allocates RAM, handles virtual memory and swap |
| Virtual File System (VFS) | Unified interface for ext4, NTFS, FAT, network drives |
| Network stack | TCP/IP, sockets, firewall (netfilter/iptables) |
| Device drivers | Talks to hardware — disks, GPUs, USB, NICs |
| Security (LSM) | AppArmor, SELinux policies |
| IPC | Pipes, signals, shared memory, sockets between processes |
Everything is a file
Linux's most distinctive design principle: everything is a file.
/dev/sda # your hard disk
/dev/null # the void — writes disappear, reads return nothing
/dev/random # random number generator
/proc/cpuinfo # real-time CPU info — a "file" updated by the kernel
/proc/meminfo # RAM usage as a file
/sys/class/net/ # network interfaces as files
This makes Linux scriptable in ways other OSes aren't. Redirect output to a device file, read hardware stats with cat, configure the kernel at runtime by writing to /proc — it's all just files.
Linux vs Windows vs macOS
| Feature | Linux | Windows | macOS |
|---|---|---|---|
| Cost | Free | ~$140 (Home) | Bundled with Mac |
| Source code | Open source | Closed source | Partially open (Darwin kernel) |
| Market share (desktop) | ~4% | ~73% | ~15% |
| Market share (servers) | ~96% | ~1% | ~1% |
| Package manager | apt, dnf, pacman… |
winget (limited) | Homebrew (3rd party) |
| Terminal | First-class citizen | PowerShell / WSL | Terminal (zsh) |
| Gaming | Growing (Steam/Proton) | Best support | Limited |
| Customisation | Unlimited | Limited | Limited |
| Security | Excellent (by design) | Improving | Good |
| Privacy | High (no telemetry) | Concerns | Some concerns |
| Driver support | Good (most hardware) | Excellent | Only Apple hardware |
| Learning curve | Steeper initially | Familiar | Familiar |
Why servers run Linux, not Windows
- Cost — no per-server license fee (saves thousands per machine)
- Stability — Linux servers routinely run for years without rebooting
- Performance — lower overhead, better process scheduling
- Security — smaller attack surface, mandatory access controls
- Scripting — shell scripting and automation are native
- Containers — Docker and Kubernetes were built for Linux
Linux distributions explained
The Linux kernel is just the engine. A distribution (distro) adds everything else: package manager, desktop environment, default apps, security policies, and support model.
Major distribution families
Linux Kernel
├── Debian family
│ ├── Debian (stable, conservative)
│ ├── Ubuntu (desktop + server, beginner-friendly)
│ │ ├── Ubuntu LTS (long-term support, 5 years)
│ │ └── Ubuntu derivatives: Linux Mint, Pop!_OS, Elementary OS
│ └── Kali Linux (penetration testing)
├── Red Hat family
│ ├── Red Hat Enterprise Linux / RHEL (commercial, enterprise)
│ ├── Fedora (cutting edge, upstream for RHEL)
│ ├── CentOS Stream (RHEL upstream)
│ └── Rocky Linux / AlmaLinux (RHEL-compatible free alternatives)
├── Arch family
│ ├── Arch Linux (rolling release, DIY, expert)
│ └── Manjaro (Arch-based, user-friendly)
├── SUSE family
│ ├── openSUSE Leap (stable)
│ └── SUSE Linux Enterprise (commercial)
└── Independent
├── Gentoo (source-based, compile everything)
├── Slackware (oldest active distro, minimalist)
└── NixOS (reproducible builds, functional config)
Which distro should you choose?
| Use case | Recommended distro |
|---|---|
| First Linux desktop | Ubuntu, Linux Mint, Pop!_OS |
| Production web server | Ubuntu LTS, Debian, Rocky Linux |
| Enterprise (paid support) | RHEL, SUSE Enterprise |
| Developer workstation | Fedora, Ubuntu, Arch |
| Security testing | Kali Linux, Parrot OS |
| Privacy-focused | Tails, Whonix |
| Minimal / embedded | Alpine Linux, Buildroot |
| Learning Arch / hardcore | Arch Linux, Gentoo |
| Raspberry Pi / IoT | Raspberry Pi OS, Alpine |
The Linux filesystem hierarchy
/ root of everything
├── /bin essential binaries (ls, cp, cat)
├── /sbin system binaries (fdisk, iptables)
├── /etc configuration files (nginx.conf, fstab)
├── /home user home directories (/home/alice)
├── /root root user's home directory
├── /var variable data (logs, databases, mail)
│ └── /var/log system logs
├── /tmp temporary files (cleared on reboot)
├── /usr user programs and libraries
│ ├── /usr/bin most user commands
│ ├── /usr/lib libraries
│ └── /usr/local locally installed software
├── /opt optional/third-party software
├── /dev device files (/dev/sda, /dev/null)
├── /proc virtual filesystem — kernel and process info
├── /sys virtual filesystem — hardware/driver info
├── /mnt temporary mount points
└── /boot bootloader and kernel images
Essential Linux commands
Navigation & files
pwd # print working directory
ls -la # list all files with permissions
cd /var/log # change directory
mkdir -p projects/demo # create nested directories
cp source.txt dest.txt # copy a file
mv old.txt new.txt # move/rename
rm -rf folder/ # delete folder recursively (careful!)
find / -name "*.log" # find files by name
Viewing & editing files
cat file.txt # print file contents
less file.txt # page through file (q to quit)
head -n 20 file.txt # first 20 lines
tail -f /var/log/syslog # follow log file live
grep "error" app.log # search in file
grep -r "TODO" src/ # search recursively
nano file.txt # beginner-friendly editor
vim file.txt # powerful modal editor
Processes
ps aux # list all running processes
top # live process monitor
htop # improved top (install separately)
kill 1234 # kill process with PID 1234
kill -9 1234 # force kill
pkill nginx # kill process by name
bg / fg # background / foreground jobs
Users & permissions
whoami # current username
sudo command # run as root
su - alice # switch to user alice
chmod 755 script.sh # set file permissions
chown alice:alice file # change owner
passwd # change password
useradd -m bob # create user bob
usermod -aG sudo bob # add bob to sudo group
Permissions explained
-rwxr-xr--
│├──┤├──┤├──┤
││ │ │ └── other: r=4, no write(2), no execute(1) → 4
││ │ └───── group: r=4, no write, x=1 → 5
│└──┘ └───── owner: r=4, w=2, x=1 → 7
└── file type: - = regular, d = directory, l = symlink
chmod 755 = owner can read/write/execute; group and others can read/execute.
Networking
ip a # show network interfaces and IPs
ip r # show routing table
ping google.com # test connectivity
curl https://api.example.com # HTTP request
wget https://example.com/file.zip # download file
ss -tlnp # show listening ports
nmap -sV 192.168.1.1 # scan host for open ports
ssh user@192.168.1.10 # connect via SSH
scp file.txt user@host:/tmp/ # copy file over SSH
Package management
# Debian/Ubuntu (apt)
sudo apt update # refresh package list
sudo apt install nginx # install package
sudo apt remove nginx # uninstall
sudo apt upgrade # upgrade all packages
apt search python # search packages
# Red Hat/Fedora (dnf)
sudo dnf install httpd
sudo dnf remove httpd
sudo dnf update
# Arch Linux (pacman)
sudo pacman -Syu # update everything
sudo pacman -S git # install
sudo pacman -R git # remove
Disk & storage
df -h # disk usage by filesystem
du -sh * # disk usage of current directory items
lsblk # list block devices
mount /dev/sdb1 /mnt # mount a partition
umount /mnt # unmount
fdisk -l # list all disks and partitions
The shell and scripting
The shell is the command interpreter. The most common shells:
| Shell | Description |
|---|---|
| bash | Bourne Again Shell — default on most distros |
| zsh | Extended bash — default on macOS, popular with Oh My Zsh |
| fish | Friendly Interactive Shell — auto-suggestions out of the box |
| sh | POSIX shell — lowest common denominator, maximum portability |
| dash | Faster sh — used for system scripts on Ubuntu |
A simple bash script
#!/bin/bash
# backup.sh — backs up a directory with timestamp
set -euo pipefail # exit on error, undefined var, pipe failure
SOURCE_DIR="${1:?Usage: $0 <source> <dest>}"
DEST_DIR="${2:?Usage: $0 <source> <dest>}"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
BACKUP_NAME="backup_${TIMESTAMP}.tar.gz"
echo "Backing up ${SOURCE_DIR} → ${DEST_DIR}/${BACKUP_NAME}"
mkdir -p "${DEST_DIR}"
tar -czf "${DEST_DIR}/${BACKUP_NAME}" "${SOURCE_DIR}"
echo "Done! $(du -sh "${DEST_DIR}/${BACKUP_NAME}" | cut -f1)"
chmod +x backup.sh
./backup.sh /home/alice/projects /backups
Linux in the cloud and DevOps
Almost everything in modern DevOps runs on Linux:
| Technology | Linux connection |
|---|---|
| Docker | Linux namespaces + cgroups = containers |
| Kubernetes | Orchestrates Linux containers |
| AWS EC2 | VMs running Amazon Linux, Ubuntu, RHEL |
| GitHub Actions runners | Ubuntu by default |
| Ansible | Connects via SSH to manage Linux servers |
| Nginx / Apache | Web servers that run on Linux |
| PostgreSQL / MySQL | Databases installed on Linux |
| Redis | In-memory store on Linux |
| systemd | Linux service manager — starts your apps on boot |
Managing services with systemd
# Start/stop/restart a service
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
# Enable to start on boot
sudo systemctl enable nginx
# Check status
sudo systemctl status nginx
# View logs for a service
journalctl -u nginx -f
Linux security basics
File permissions and sudo
Never run as root by default. Use sudo only when needed. This limits the blast radius of mistakes and compromises.
# BAD — running as root all the time
rm -rf /important # typo could wipe the system
# GOOD — use sudo only for privileged operations
sudo systemctl restart nginx
SSH key authentication
# Generate an SSH key pair
ssh-keygen -t ed25519 -C "you@example.com"
# Copy public key to server
ssh-copy-id user@server
# Connect without password
ssh user@server
# Disable password auth (server's /etc/ssh/sshd_config)
PasswordAuthentication no
PubkeyAuthentication yes
Firewall with ufw (Ubuntu)
sudo ufw enable
sudo ufw allow ssh # allow SSH
sudo ufw allow 80/tcp # allow HTTP
sudo ufw allow 443/tcp # allow HTTPS
sudo ufw status # show rules
sudo ufw deny 23 # block telnet
Common security tools
| Tool | Purpose |
|---|---|
ufw / iptables |
Firewall rules |
fail2ban |
Ban IPs after failed SSH attempts |
unattended-upgrades |
Auto-install security patches |
auditd |
Audit system calls and file access |
AppArmor / SELinux |
Mandatory access control |
openssl |
TLS certificates and crypto |
nmap |
Port scanning and network discovery |
lynis |
Security auditing and hardening tool |
Getting started with Linux
Option 1: Try without installing (Live USB)
Download an Ubuntu ISO, flash it to a USB drive with Balena Etcher, boot from it — you can try Linux without touching your hard drive.
Option 2: Windows Subsystem for Linux (WSL 2)
# In PowerShell (Windows 10/11)
wsl --install
# Installs Ubuntu by default
# Then open "Ubuntu" from the Start menu
WSL 2 gives you a full Linux kernel running inside Windows — great for development.
Option 3: Virtual machine
Install VirtualBox (free) and create a VM with Ubuntu. Low risk, easy to snapshot and revert.
Option 4: Dual boot
Install Linux alongside Windows. The installer handles partitioning. Choose which OS to boot each time.
Option 5: Dedicated machine
- Raspberry Pi — $35 credit-card-sized computer, runs Raspberry Pi OS (Debian-based)
- Old laptop — Linux runs well on older hardware Windows struggles with
- VPS/cloud — spin up a $5/month DigitalOcean Droplet or AWS EC2 instance
Linux learning path
| Stage | Topics | Time |
|---|---|---|
| Beginner | Basic navigation, files, permissions, package manager | 1-2 weeks |
| Intermediate | Shell scripting, processes, networking, SSH, systemd | 1-2 months |
| Advanced | Kernel basics, security hardening, performance tuning, containers | 3-6 months |
| Expert | Kernel modules, custom distros, embedded Linux, security research | Ongoing |
Recommended learning resources
| Resource | Type | Best for |
|---|---|---|
| The Linux Command Line | Free book | Beginners |
| OverTheWire: Bandit | Interactive wargame | Learning by doing |
| Linux Journey | Interactive lessons | Visual learners |
man command |
Built-in manual | Every command |
tldr command |
Simplified man pages | Quick reference |
| Arch Wiki | Documentation | Depth on any topic |
Common Linux use cases
| Use case | Why Linux |
|---|---|
| Web servers | Nginx/Apache run best on Linux; no licensing cost |
| DevOps / SRE | All CI/CD, containers, and infrastructure is Linux |
| Data science | Python/R tools, Jupyter — native Linux ecosystem |
| Security research | Kali Linux, custom tools, full system access |
| Game development | Steam/Proton, Godot, Unreal Engine — Linux support growing |
| Embedded systems | Routers, TVs, cars, IoT — tiny Linux footprint |
| Programming | Better toolchain support, shell scripting, SSH remoting |
| Privacy | No telemetry by default, full transparency |
Common mistakes
| Mistake | Better approach |
|---|---|
| Running as root all the time | Use sudo only when necessary |
rm -rf / or rm -rf * in wrong directory |
Use rm -i (interactive), double-check path first |
| Ignoring file permissions | Understand owner/group/other; set 644 for files, 755 for dirs |
| Installing from random scripts | curl ... | sudo bash — verify source first |
| Forgetting to back up before changes | Always backup; test restores |
| Leaving default SSH config | Disable root SSH login, use keys, change default port |
| Not reading error messages | Linux errors are usually descriptive — read them |
Skipping man pages |
man <command> is your best friend |
Linux vs related concepts
| Term | What it is |
|---|---|
| Linux | The kernel (or loosely, the OS built around it) |
| GNU/Linux | Full name: GNU tools + Linux kernel |
| Unix | The original OS Linux was inspired by (not open source) |
| POSIX | Standard that Unix-like OSes (Linux, macOS) follow |
| Bash | Shell (command interpreter) that runs on Linux |
| Ubuntu | A Linux distribution — not Linux itself |
| Android | Linux kernel + Google's software stack |
| macOS | BSD-based Unix — shares concepts but ≠ Linux |
| WSL | Linux running inside Windows |
| Container | Isolated Linux process — uses Linux kernel features |
Frequently asked questions
Is Linux free?
The Linux kernel is free and open source under the GPL license. Most distributions are also free. Some enterprise distros (RHEL, SUSE Enterprise) charge for support and tooling — but the software itself is open.
Is Linux hard to learn?
The command line has a learning curve, but the fundamentals take 1-2 weeks to get comfortable with. Desktop distros like Ubuntu are very user-friendly. For developers and sysadmins, investing time in Linux pays off enormously in career and productivity.
Can I run Windows software on Linux?
Yes, via Wine (compatibility layer) or Proton (Steam's Wine fork for games). Many Windows games and apps now run on Linux. But native Linux alternatives are usually better.
Why do servers use Linux and not Windows?
Cost (no licensing), stability (multi-year uptimes), security (smaller attack surface), performance, and the entire DevOps toolchain is built for Linux. Windows Server exists but is a niche choice for most workloads.
What's the difference between a terminal and the shell?
The terminal is the window/app you type into. The shell (bash, zsh) is the program that interprets your commands. Terminal emulators: GNOME Terminal, Alacritty, iTerm2. Shells: bash, zsh, fish.
Should I install Linux alongside Windows or replace it?
Start with WSL 2 on Windows (zero risk), or dual-boot. Replace Windows only after you're comfortable with Linux for your daily tasks. Most developers eventually switch to Linux or macOS full-time.
Quick start cheatsheet
# System info
uname -a # kernel version
lsb_release -a # distro info
cat /proc/cpuinfo # CPU details
free -h # RAM usage
df -h # disk usage
# Navigation
ls -la # list files
cd ~ # go home
pwd # where am I?
find . -name "*.py" # find Python files
# Files
cp -r src/ dest/ # copy directory
mv file.txt ~/ # move to home
rm -i file.txt # delete (with prompt)
cat file.txt # view file
grep -r "TODO" . # search in files
# Processes
ps aux | grep nginx # find nginx process
kill -9 $(pgrep nginx) # kill it
top # live view
# Networking
ip a # show IPs
ss -tlnp # show ports
curl -I https://example.com # HTTP headers
# Package manager (Ubuntu/Debian)
sudo apt update && sudo apt upgrade
sudo apt install <package>
apt search <keyword>
# Users & permissions
sudo command # run as root
chmod 755 file # rwxr-xr-x
chown user:group file # change owner
Linux isn't just an operating system — it's the foundation of modern computing infrastructure. Whether you're a developer, sysadmin, data scientist, or security researcher, Linux skills open more doors than almost any other technical skill you can develop.
Start with WSL 2 or Ubuntu in a VM, get comfortable with the command line, and within a few months you'll wonder how you ever worked without it.