Linux Command Line · Lesson 1 of 43
What Linux is: the kernel, distributions and the shell
Understand what Linux really is, how a kernel, a distribution, a terminal and a shell fit together, and why the command line is worth learning.
UNDERSTAND IT. THEN TRY IT.
What you can do after this lesson
You will know what people mean when they say "Linux", "the terminal" and "the shell", and why those words are not interchangeable. That vocabulary matters because every later lesson uses it, and because search results, error messages and tutorials mix the terms constantly.
Linux is a kernel
Strictly, Linux is a kernel. The kernel is the core of an operating system. It starts programs, shares the processor and memory between them, talks to the disk and the network, and enforces who may do what. Linus Torvalds began it in 1991, and thousands of people have contributed since.
A kernel alone is not something you can use. You also need a program to start the system, tools to copy files, a way to install software and, usually, a graphical desktop. Those pieces mostly come from other projects, many of them from the GNU project, which is why you will sometimes see the whole system called GNU/Linux.
Distributions
A distribution, or distro, packages the Linux kernel with all of that: the shell, thousands of command line tools, a package manager, default settings and often a desktop. Popular families include:
- Debian and Ubuntu, which use the
aptpackage manager. - Fedora, Red Hat Enterprise Linux and AlmaLinux, which use
dnf. - Arch Linux, which uses
pacman. - Alpine Linux, a tiny distribution often used in containers.
The commands in this course work on all of them. Where distributions differ, mainly in package management, a lesson tells you. You can also practise on Windows with WSL (the Windows Subsystem for Linux), on a rented cloud server, in a virtual machine, or on macOS, whose Terminal is similar but not identical.
You can ask any Linux system for its kernel name:
uname -sLinuxTerminal and shell
Two more words confuse beginners.
A terminal (or terminal emulator) is the window where text appears and where you type. Historically it was a physical screen and keyboard attached to a big computer.
A shell is the program running inside that window. It reads each line you type, works out what you mean, starts the right program and shows you the result. Bash (the Bourne Again Shell) is the default on most distributions and is the shell this course teaches. Others include Zsh, which is the default on modern macOS, and Fish.
So when you open a terminal, you are looking at a window with a shell inside it. You can see which shell is running with a command that asks the system about your own process:
ps -p $$ -o comm=bashWhy learn the command line
A graphical program is easy to discover but hard to repeat. The command line is the opposite: you must learn the words, but then you gain real advantages.
- Speed. Renaming 500 files takes one line instead of 500 clicks.
- Repeatability. A command can be saved in a script and run again tomorrow, or on a hundred servers.
- Precision. You say exactly what you want, and you can see exactly what happened.
- Availability. Most servers, containers, build systems and cloud tools have no desktop at all.
- Power through combination. Small tools connect like building blocks, as you will see when we reach pipes.
Two ideas that run through everything
Everything is a file. Documents, folders, devices and even running processes show up as files or directories you can list and read. That is why the same few commands work on so many things.
Small tools that combine. sort sorts. wc counts. grep searches. None of them does much alone, but sending the output of one into the next solves problems that no single tool covers.
Common mistakes
Thinking Linux and Ubuntu are the same thing. Ubuntu is one distribution of many. Most commands work everywhere, but package commands differ.
Using "terminal" and "shell" as synonyms. They are different parts, and the difference explains why one terminal window can run Bash today and Zsh tomorrow.
Expecting macOS to behave exactly like Linux. macOS is Unix-based, but its tools come from BSD, so some options differ. This course notes the main differences.
Being afraid to type. Commands do not run until you press Enter, and almost all of them only read information. We will mark the few that change or delete things.
Exercise
Open a terminal on whatever system you have (a Linux machine, WSL, a virtual machine, or macOS Terminal). Without running anything yet, write down the answers to these questions in your own words: What is the kernel? What is a distribution? What is the difference between the terminal and the shell? Then run uname -s and note what it prints on your machine. In the next lesson you will type real commands, so make sure you can find and open your terminal.
KNOWLEDGE CHECK
A quick check. You’ve got this.
Try each question. Every answer comes with an explanation.
Ready for the next small win?
Mark the lesson complete when you are ready.