Linux and distributions
What is on the other end when you log in to a Linux server?
Linux is a kernel; a distribution such as Ubuntu or Red Hat Enterprise Linux packages it with tools and a package manager.
You are given a login on a server called web01, and told it runs Linux. What is that, exactly? Linux itself is the kernel: the program that runs the hardware and shares it between everything else. Nobody installs a kernel on its own. A distribution adds the tools, such as the shell and its commands, and a package manager for installing more. Distributions come in families. Ubuntu and Debian install software with apt. Red Hat Enterprise Linux and its free rebuilds, AlmaLinux and Rocky Linux, use dnf. Nearly every command in this course is the same on both, and where they differ you will see both.
Terminal and shell
Your text goes to a shell, and the shell starts programs
The terminal draws text; the shell reads each line and asks the kernel to run the program it names.
Before any command, get the parts straight. You type a line. The terminal only draws characters and passes keys on. The shell, usually bash, is the program that reads the line, works out what it means, and finds the program to run. It asks the kernel to start that program as a new process, waits for it to finish, and prompts again. The prompt itself is information: the user, the host, the directory you are in, and a dollar sign for a normal user or a hash for root.
First commands
Which commands are safe to type first on any machine?
whoami, hostname, pwd, ls and date only read. They tell you who you are, on which machine, and where.
The first thing to do on any server is find out where you are. whoami prints your account. hostname prints the machine, which matters when you have six terminals open. pwd prints the directory you are in. ls lists what is in it. date prints the time the server keeps, usually U T C. Each command prints its answer and the prompt comes back. None of them changes anything.
Command syntax
One line: a program name, then options and arguments
The first word names the program; options change how it works and arguments say what to work on.
Every command line has the same anatomy. The first word is the program. Short options start with one dash and can be bundled. Long options start with two, and can carry a value after an equals sign. The rest are arguments, usually files or directories. Some options take the next word as their value: in tar dash c z f, the f must come last, because the archive name follows it. In the end the program simply receives a numbered list of words, and decides for itself what they mean.
Manual pages
The manual comes in numbered sections; ask for the right one
man pages are grouped in sections: 1 for commands, 5 for file formats, 8 for admin commands. man -k searches them.
Every Linux system carries its own manual, and in the practical exams it is the only reference you have. It is divided into numbered sections. One holds user commands, five holds file formats, eight holds administration commands. So man passwd is the command, and man five passwd describes the file. When you only know the task, man dash k searches every summary. For a quick reminder, most commands answer dash dash help, and help covers bash builtins.
Lab
Get a machine of your own and look around it
A virtual machine, WSL or a small cloud server gives you a Linux you are free to break, which is how the rest of the course is practised.
Reading about commands does not teach them; typing them does. In this lab you set up a practice machine, read your prompt, list files with options, and find an answer in the manual. Press the down arrow for the steps.
Lab · Going deeper
A practice machine and ten commands
You need a Linux machine you are free to break. Any of the three in step 1 will do for the whole course.
You need a Linux machine you are free to break. Any of the three in step 1 will do for the whole course. Steps. Get a machine. On Windows, run wsl --install in PowerShell and restart: you get Ubuntu in a window. On any computer, install Ubuntu Server 24.04 LTS in a virtual machine (VirtualBox, or UTM on a Mac). Or rent the smallest cloud server and connect with ssh. For the Red Hat exam, use AlmaLinux or Rocky Linux 10 in a virtual machine. Read the prompt. Run whoami, hostname and pwd, and match each answer to a part of your prompt. Look around. Run ls, then ls -l, ls -a and ls -la /etc. Which names appear only with -a? Ask what you are running. cat /etc/os-release, then uname -r for the kernel version, date and uptime. Ask for help. ls --help | head, then man ls. In the manual, press / to search for "sort", n for the next match and q to quit. Use the four keys. Recall a command with the up arrow, complete /etc/host with Tab, start sleep 100 and stop it with Ctrl-C, and leave with exit. Check: You can say which distribution and version you are on, and you found the ls option that sorts by time without leaving the terminal.
Steps
- Get a machine. On Windows, run wsl --install in PowerShell and restart: you get Ubuntu in a window. On any computer, install Ubuntu Server 24.04 LTS in a virtual machine (VirtualBox, or UTM on a Mac). Or rent the smallest cloud server and connect with ssh. For the Red Hat exam, use AlmaLinux or Rocky Linux 10 in a virtual machine.
- Read the prompt. Run whoami, hostname and pwd, and match each answer to a part of your prompt.
- Look around. Run ls, then ls -l, ls -a and ls -la /etc. Which names appear only with -a?
- Ask what you are running. cat /etc/os-release, then uname -r for the kernel version, date and uptime.
- Ask for help. ls --help | head, then man ls. In the manual, press / to search for "sort", n for the next match and q to quit.
- Use the four keys. Recall a command with the up arrow, complete /etc/host with Tab, start sleep 100 and stop it with Ctrl-C, and leave with exit.
Lesson complete
You finished “What Linux is, and your first commands”
Nicely done.