Linux and distributions

What is on the other end when you log in to a Linux server?

A distribution: one complete, installable systemLinux kernelruns the hardware, shares it outToolsbash, ls, grep, systemdPackage manager and defaultshow software is installed and kept up to dateDebian familyUbuntuDebianaptpackages are .deb filesRed Hat familyRed Hat Enterprise LinuxAlmaLinux, Rocky LinuxFedoradnfpackages are .rpm filesLinux is the kernel. A distribution is the kernel plus the tools and the package manager around it.The commands in this course are the same on both families. They differ mainly in how software is installed and in a few filelocations, and where they do, both are shown. Transcripts come from Ubuntu Server 24.04 LTS and from AlmaLinux 10,a free rebuild of Red Hat Enterprise Linux 10. cat /etc/os-release tells you which one you have logged in to.

Linux is a kernel; a distribution such as Ubuntu or Red Hat Enterprise Linux packages it with tools and a package manager.

Terminal and shell

Your text goes to a shell, and the shell starts programs

you typeterminaldraws charactersshell (bash)reads the line, expands it,finds the programfork, execkernelstarts the processthe programls, grep, systemctlThe prompt the shell prints, taken apartanauser@web01host:~/logscurrent directory$not rootand for root:#root~ means /home/ana, the home directoryThe terminal only draws text. The shell is the program that reads your line and runs others.Bash prints a prompt, reads one line, works out what each word means, and asks the kernel to start the program named first.It waits for that program to end, then prompts again. Over SSH the terminal is on your laptop and the shell is on the server.The prompt says who you are, where, and on which machine: read it before every command that changes something.

The terminal draws text; the shell reads each line and asks the kernel to run the program it names.

First commands

Which commands are safe to type first on any machine?

ana@web01:~$ whoami1ana$ hostname2web01$ pwd3/home/ana$ ls4logs notes.txt reports$ date5Mon Nov 16 06:59:03 UTC 2026$ 1Which account am I?the user the server knows you as2Which machine is this?check before you change anything3Where am I?the directory commands will act in4What is here?the files and directories in it5What time does it think it is?servers usually keep UTCType a command, press Enter, read the answer. The prompt comes back when the command has ended.None of these five changes anything, so they are safe on any machine. A command that prints nothing has usually worked.Four keys to know from the first minute: the up arrow recalls the last command, Tab completes a name,Ctrl-C stops a command that will not end, and exit (or Ctrl-D) closes the session.

whoami, hostname, pwd, ls and date only read. They tell you who you are, on which machine, and where.

Command syntax

One line: a program name, then options and arguments

lscommand-loption-hoptionor together: -lh--sort=sizelong option, with a value/var/logargumenttarcommand-czfthree optionsetc.tar.gzvalue of -f/etcargumentf takes the next wordWhat the program receivesargv[0] lsargv[1] -largv[2] -hargv[3] --sort=sizeargv[4] /var/loga list of words; the program decides what each meansA command line is words split on spaces: the first names a program, and the rest are handed to it.By convention a single dash starts short options that can be bundled (-lh), and two dashes start a long option (--sort=size).Some options take a value: in tar -czf, the f must come last because the next word is its file name. Anything else is anargument, usually a file or directory. The convention is the program’s, not the shell’s, so a few old commands differ.

The first word names the program; options change how it works and arguments say what to work on.

Manual pages

The manual comes in numbered sections; ask for the right one

1 User commandsls, passwd, ssh2 System callsopen, fork3 Library functionsprintf4 Special files/dev/null5 File formats/etc/passwd, fstab6 Games7 Overviewsregex, signal8 Admin commandsmount, useraddman passwdthe command that changes a password (section 1)man 5 passwdthe format of the file /etc/passwd (section 5)man -k passwordsearch every page’s one-line summary (same as apropos)ls --helpthe quick cardhelp cdbash builtins/usr/share/docexamples, notesThe manual is split into numbered sections, and the same name can live in more than one.man shows the lowest section first, so man passwd is the command; man 5 passwd is the file it edits. Inside a page, / searchesand q quits; the SYNOPSIS shows optional parts in [brackets] and repeatable ones with an ellipsis. In the exams, man is allowedand is the fastest way to recall a flag: man -k finds the page when you only know what you want to do.

man pages are grouped in sections: 1 for commands, 5 for file formats, 8 for admin commands. man -k searches them.

Lab

Get a machine of your own and look around it

$ head -1 /etc/os-release1PRETTY_NAME="Ubuntu 24.04.5 LTS"$ ls -la2total 32drwxr-x--- 4 ana ana 4096 Nov 16 07:00 .drwxr-xr-x 5 root root 4096 Nov 16 06:59 ..-rw-r--r-- 1 ana ana 3771 Mar 31 2024 .bashrcdrwxrwxr-x 2 ana ana 4096 Nov 16 06:59 logs-rw-rw-r-- 1 ana ana 5 Nov 16 06:59 notes.txt...$ ls --help | head -23Usage: ls [OPTION]... [FILE]...List information about the FILEs (the current directory by default).1Which Linux is this?name and version2Options change the answer-l long, -a hidden files too3Every command explains itselfthen man ls for the full pageLab: get a Linux machine of your own and run your first commands on it.Six short steps, from installing a practice machine to reading a manual page. Press the down arrow.

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.

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.

Steps

  1. 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.
  2. Read the prompt. Run whoami, hostname and pwd, and match each answer to a part of your prompt.
  3. Look around. Run ls, then ls -l, ls -a and ls -la /etc. Which names appear only with -a?
  4. Ask what you are running. cat /etc/os-release, then uname -r for the kernel version, date and uptime.
  5. 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.
  6. 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.

Lesson complete

You finished “What Linux is, and your first commands”

Nicely done.

Open in a new tab