Linux: Introduction to Linux — The Open-Source OS Revolution

Linux is the operating system every developer will eventually face. Whether you're deploying backend services, configuring databases, or running CI/CD pipelines, the server is most likely running Linux.

📋 Prerequisites: No prior experience required

1. What You Will Learn


2. A Beginner's Story: First Encounter with a Server

(1) The Pain: Feeling Lost When Facing a Server for the First Time

Alex is a developer who recently switched to Linux. His company gave him a MacBook, but his backend colleagues fly through the terminal. He needed to log into a Linux server to check logs, yet after opening the terminal he didn't even know what "ls" meant.

Senior engineer Bob told him: "Linux is an essential skill for every developer — not because you need it as a desktop OS, but because the vast majority of internet services run on Linux."

(2) Linux's Solution

Bob introduced Alex to Linux: a free, open-source operating system kernel stable enough to run continuously for years. Any device — from a Raspberry Pi to a NASA Mars rover — can run it.

BASH
# Check how long a Linux server has been running
uptime
# Sample output: 10:23  up 187 days, 4 users, load average: 0.08 0.03 0.01

(3) The Benefit: Understanding Infrastructure

After completing this lesson, Alex understood what OS powers the GitHub, Netflix, and YouTube services he uses every day — and why Linux dominates the server market.


3. Knowledge Points

(1) What Is Linux

Strictly speaking, Linux is only a kernel — the core component of an operating system responsible for managing hardware resources, process scheduling, filesystems, and more. In 1991, Finnish university student Linus Torvalds released its first version.

But what people commonly call "Linux" actually refers to the GNU/Linux operating system — the complete combination of the Linux kernel and the GNU toolset (commands like cp, mv, ls, bash, etc.).

💡 Tip: The distinction between "Linux" and "GNU/Linux" is a common exam and interview question. Strictly speaking, Android also uses the Linux kernel, but it doesn't include the GNU toolset, so it's not considered GNU/Linux.

(2) Linux vs Windows vs macOS

The three major operating systems differ fundamentally in design and philosophy:

Dimension Linux Windows macOS
Kernel Linux (open source) NT (closed source) XNU (partially open)
Package management apt/yum/dnf EXE/MSI Homebrew
Command line bash/zsh (core experience) PowerShell (add-on) zsh (Linux-like)
Filesystem ext4/XFS/Btrfs NTFS APFS
Desktop environment GNOME/KDE (user's choice) Fixed desktop Aqua
License GPL (open source, free) Commercial license Commercial license
Primary market Servers / Embedded Desktop / Enterprise Desktop / Creative

(3) Major Distribution Families

Linux has hundreds of distributions, but only four core families:

Family Package manager Representative distros Best for
Debian family apt/.deb Ubuntu, Debian, Linux Mint Beginners, servers
RHEL family yum/dnf/.rpm RHEL, Fedora, CentOS Enterprise servers
Arch family pacman Arch Linux, Manjaro Enthusiasts, latest software
Alpine apk Alpine Linux Minimal Docker images

(4) Why Servers Run Linux

(5) ▶ Example: Check the Linux Kernel Version

BASH

uname -r
# Sample output: 5.15.0-91-generic

Output:

TEXT
5.15.0-91-generic

(6) ▶ Example: Check Distribution Information

TEXT
lsb_release -a
# Sample output:
# Distributor ID: Ubuntu
# Description:    Ubuntu 22.04.3 LTS
# Release:        22.04
# Codename:       jammy

(7) ▶ Example: Check System Uptime

BASH
uptime
# Sample output: 10:23:45 up 187 days, 4 users, load average: 0.08 0.03 0.01

Output:

TEXT
10:23:45 up 187 days, 4 users, load average: 0.08, 0.03, 0.01

(8) ▶ Example: Check CPU and Memory Information

BASH
# CPU info
lscpu | grep "Model name"

# Total memory
free -h | grep Mem

Output:

TEXT
Model name:                      Intel(R) Core(TM) i7-12700K
Mem:              15Gi       4.0Gi        11Gi       256Mi       2.0Gi        11Gi

(9) ▶ Example: Package Management Commands Across Distributions

BASH
# Debian/Ubuntu
sudo apt install nginx

# RHEL/Fedora/CentOS
sudo yum install nginx   # or dnf
sudo dnf install nginx

# Arch
sudo pacman -S nginx

# Alpine
apk add nginx

Output:

TEXT
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
  nginx
0 upgraded, 1 newly installed, 0 to remove.
Need to get 42.3 kB of archives.

(10) ▶ Comprehensive Example: Get to Know Your Linux System

Log into a Linux machine (or WSL) and run the following commands to learn its basic information:

BASH
echo "=== Kernel Version ===" && uname -r && \
echo "=== Distribution ===" && lsb_release -d && \
echo "=== Uptime ===" && uptime && \
echo "=== CPU ===" && lscpu | grep "Model name" && \
echo "=== Memory ===" && free -h | grep Mem

❓ FAQ

Q: What's the difference between Linux and Unix? A: Unix is an OS developed at Bell Labs in the 1970s, commercially licensed and closed source. Linux is a Unix-like kernel written from scratch by Linus Torvalds, fully open source and free, containing no Unix code. Linux is described as "Unix-like."

Q: Why do most servers run Linux? A: Free (no Windows Server license fees), stable (can run for years without rebooting), low resource usage (CLI only needs a few hundred MB of RAM), remote-friendly (SSH), and rich ecosystem (nearly all server software prioritizes Linux support).

Q: Which distribution is best for beginners? A: \1

Q: Is Linux on the desktop suitable for daily use? A: Suitable for general office work (browser/office apps/dev tools), but still has shortcomings: the Adobe suite is unavailable, some games aren't supported, and the Tencent ecosystem (WeChat/QQ) has a mediocre experience. For developers, we recommend Windows/Mac for the desktop + WSL/virtual machine for development.

Q: What's the relationship between the Linux kernel and GNU/Linux? A: \1


📖 Summary


📝 Exercises

  1. Basic (Difficulty ⭐): Search for "Linux market share 2025" and learn the differences in market share across server, desktop, and embedded markets
  2. Intermediate (Difficulty ⭐⭐): Compare Ubuntu and Fedora on their official websites (desktop vs server, stability vs new features) and organize the results in a table
  3. Advanced (Difficulty ⭐⭐⭐): List 5 websites/apps you use daily, find out whether they run on Linux (hint: check WhoIsHostingThis), and summarize Linux's role in internet infrastructure
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏