Lesson 1 of 12 · 10 min · Working with files
What Linux is, and how to work in the shell
What you will learn
- What Linux is: the kernel, the programs around it, and what a "distribution" adds
- Why almost every server, container and cloud machine you will meet as a DevOps engineer runs it
- How to get a safe practice machine in minutes
- The shape of every command: command, options, arguments
- How to get help from the machine itself, without searching the web
In simple words
Linux is the software that runs most of the world's servers, the way Android runs most phones. You don't click on things in it. You type short instructions into a window called the shell, and the computer answers in text. This lesson gets you a safe practice computer and teaches you how every instruction is put together.
Words to know
- Kernel: the core program that controls the computer's hardware and shares it between all other programs.
- Distribution: the kernel packed with tools so you can use it. Ubuntu is one, like a ready-to-use phone with apps installed.
- Shell: the program that reads what you type and runs it. The common one is called bash.
- Command: one instruction you type, such as
lsto list files.
What Linux is, in plain words
Every computer needs one program that controls the hardware and shares it between all the other programs: it decides which program runs on the CPU now, hands out memory, reads and writes the disk, and talks to the network. That program is the kernel. Linux is a kernel. It was started by Linus Torvalds in 1991 and is now built by thousands of people and companies.
A kernel alone is not usable. You also need a way to type commands, tools to copy files, a program that starts services at boot, a way to install software. Those parts mostly come from the GNU project and others. A distribution (distro) packs the Linux kernel together with those tools, an installer and a package manager, and tests them as a set. Ubuntu, Debian, Red Hat Enterprise Linux (RHEL), Rocky Linux, Amazon Linux and Alpine are distributions. They differ in defaults and in how you install software (apt on Debian and Ubuntu, dnf on RHEL and its relatives, apk on Alpine), but the kernel and the commands in this course are the same.
your programs (nginx, python, docker, ssh ...)
------------------------------------------------
shell + core tools (bash, ls, grep ...) -- "user space"
------------------------------------------------
Linux kernel (processes, memory, files, network)
------------------------------------------------
hardware (CPU, RAM, disk, network card)
Programs never touch the hardware directly. They ask the kernel through system calls ("open this file", "send these bytes"). This is why you can run the same program on a laptop, a cloud VM or a container: it only depends on the kernel's interface.
Why DevOps engineers need it
- Most servers in the cloud run Linux, and a container is a Linux process with limits applied (you will see this in the Docker course).
- Kubernetes nodes, CI runners, build servers and almost all the tools in this path run on Linux.
- When something breaks at 2 a.m., you will have a terminal, not a mouse.
Get a practice machine
You need somewhere you can break things. Pick one:
- Docker (recommended, works the same everywhere):
docker run -it --rm ubuntu:24.04 bashgives you a fresh Ubuntu shell.--rmdeletes it when you exit, so mistakes cost nothing. A bare container is minimal: runapt-get update && apt-get install -y procps iproute2 dnsutils curl less man-dbonce inside it to get the tools later lessons use. - Windows: install WSL 2 and the Ubuntu app from Microsoft's documentation, then open "Ubuntu".
- A real VM: a free-tier cloud VM or VirtualBox gives you a full system with services and logs, closest to production.
Check where you are:
. /etc/os-release && echo "$PRETTY_NAME"
uname -sr
Ubuntu 24.04.5 LTS
Linux 7.0.0
The second line prints the kernel name and release (yours will differ). In a container this is the host's kernel, because containers share it. That is a small proof of the point above.
The shell
The shell is a program that reads what you type, runs it, and prints the result. The most common one is bash. The line it shows before your cursor is the prompt, usually ending in $ for a normal user and # for root (the administrator).
Every command has the same shape:
command [options] [arguments]
ls -l -a /var/log
- The command is a program name.
- Options (also called flags) change how it behaves. Short options use one dash (
-l), long ones two (--all). Short ones can be combined:ls -laequalsls -l -a. - Arguments say what to act on: files, directories, text.
Spaces separate words, so a name with a space must be quoted: ls "My Documents". Linux is case sensitive: Notes.txt and notes.txt are different files.
Getting help from the machine
You will not remember every option, and nobody does. Learn the three built-in helpers:
ls --help | head -5 # short usage, works for most commands
man ls # the full manual page; press q to quit, / to search
type cd # is it a program, a shell built-in, or an alias?
man pages are the official reference for each command, and they are always installed in the version you are running, which matters because options differ between systems. Pages are grouped in numbered sections: section 1 is commands, 5 is file formats, 8 is administration commands. You will see references like chmod(1) or passwd(5): the number is the section (man 5 passwd opens the file-format page instead of the command).
Keyboard habits that save hours
- Tab completes names. Press it twice to list the options.
- Up arrow or Ctrl+R (type to search) brings back earlier commands.
- Ctrl+C stops the running command. Ctrl+D ends input (and exits an empty shell). Ctrl+L clears the screen.
A first walk
whoami # which user am I?
pwd # print working directory: where am I?
ls # list this directory
ls -la # long format, including hidden files (names starting with a dot)
echo "hello" # print text
Everything here is read-only, so it is safe to try. In the next lessons you will learn how the directory tree is laid out, how to create and move things, and how permissions decide who may do what.
Common mistakes
- Treating Linux and Ubuntu as the same thing. Ubuntu is one distribution. When an interviewer asks "Which distros have you used?", they expect names like Ubuntu, Amazon Linux or RHEL-family.
- Typing commands you do not understand as root. Root can delete the whole system without a question. Work as a normal user and use
sudofor the one command that needs it (lesson 4). - Pasting commands from the internet unread. Read each one first, especially anything with
rm,sudo,chmod -Rorcurl ... | sh.
Try it yourself
- Start an Ubuntu container and print the distribution name and the kernel release.
- Run
ls -l /and find three directories you recognise. Then runman 5 passwdand read the first paragraph. - Use
typeoncd,lsandecho. Which of them are shell built-ins and which are separate programs? (Hint:typetells you.)
Check yourself
Is Linux an operating system or a kernel? What is a distribution?
Strictly, Linux is the kernel: the part that manages CPU, memory, devices, files and networking. A distribution bundles the kernel with user-space tools (shell, core utilities, init system), an installer and a package manager, so you get a usable operating system. Ubuntu, Debian and RHEL are distributions.
What do the three parts of ls -la /var/log mean?
ls is the command, -la are two combined short options (long listing, include hidden files), and /var/log is the argument: the directory to list.
You see crontab(5) in documentation. What does the 5 mean and how do you open it?
It is the manual section: 5 is file formats. Open it with man 5 crontab. Without the number, man crontab shows the command (section 1) first.
Why does uname -r inside a container show the same kernel as the host?
Containers are not virtual machines. They are ordinary processes that share the host kernel and only get their own view of files, processes and network.
Interview questions
What is the difference between Linux and Unix?
Unix is the original family of operating systems from Bell Labs and its commercial descendants (AIX, Solaris, macOS is certified Unix). Linux is a separate, free kernel that follows Unix design ideas and the POSIX standard, but it contains no original Unix code. Day to day, the commands are very similar.
Why do most servers and containers use Linux?
It is free, stable, scriptable from the command line, runs on almost any hardware, and the container and orchestration tooling (Docker, Kubernetes) is built on Linux kernel features.
Summary
- Linux is a kernel; a distribution adds the tools, installer and package manager around it.
- Programs talk to hardware only through the kernel, which is why the same software runs on laptops, VMs and containers.
- A command is
command [options] [arguments]; learn--help,manandtypeand use Tab and Ctrl+R. - Practise in a disposable container so mistakes are free.
Going deeper
- Ubuntu command line for beginners: a guided first session on Ubuntu.
- GNU Bash Reference Manual: the shell itself, when you want the exact rules.
- Linux man-pages project: the authoritative manual pages for Linux commands and system calls.
- Install WSL (Microsoft): Linux on Windows.
See how much of this you can explain
A free mock interview asks you new questions on Linux for DevOps for DevOps Engineer and scores every answer, with what to fix.