Programming and IT
How to learn Linux from scratch
Linux runs most servers, containers and countless devices, so developers, testers, analysts and system administrators all need the command line. The easiest way to learn it is not by reading lists of commands but by working in the terminal every day and solving small practical tasks. Below is a sequence of topics for two to three months.
In this article
Where to get Linux without breaking anything#
You do not need to reinstall your main system. Safe options:
- a virtual machine (VirtualBox, or UTM on a Mac) with Ubuntu or Debian;
- WSL on Windows — a Linux environment right inside the system;
- a cheap cloud server — the closest to real work, and you learn to log in over SSH along the way.
Any popular distribution is fine to start: Ubuntu, Debian, Fedora. For a
beginner the difference is mostly the package manager (apt or dnf).
The first two weeks: the file system and navigation#
The directory tree starting at the root /: where settings live (/etc), logs
(/var/log), home directories (/home). Basic commands:
# where am I
The built-in help is man command and command --help. Make them the first
place you look. Be careful with rm -r: the terminal has no trash can.
Weeks 3–4: permissions, users, sudo#
Owner, group, others; read, write and execute permissions. The notation
rwxr-xr-- and its numeric form 754: each group of three turns into a number
(r = 4, w = 2, x = 1). Commands: chmod, chown, sudo, id, useradd.
Exercise: create a user and a shared directory for a group, then check who can
do what in it.
Weeks 5–6: text, streams, searching#
The power of the command line is in combining small programs. Redirection with
> and >>, the | pipe, and the commands grep, sort, uniq, wc, head,
tail, find, cut. A sample task: find the ten IP addresses that appear most
often in a web server log. For a terminal text editor, start with nano and
learn the basics of vim later.
Weeks 7–8: packages, processes, services, networking#
Installing software with the package manager, viewing processes (ps, top or
htop), signals and kill. Services under systemd: systemctl status, start,
enable, and logs through journalctl. Networking: ip a, ping, curl, ss,
and logging in to a server with an SSH key instead of a password.
Weeks 9–10: bash scripts#
Variables, conditions, loops, script arguments, exit codes. Useful first
scripts: back up a directory into an archive with the date in its name, clean up
old files, check free disk space and warn when it runs low. Run them on a
schedule with cron or systemd timers. Keep your scripts in a Git repository and
check them with the ShellCheck analyser.
A practice project#
On a virtual machine or a cloud server, set up the nginx web server with your own page, configure a firewall, key-only login, a daily backup script and log rotation. Describe every step in a README so that anyone could repeat the setup on a clean system — a good sign that you understand the commands rather than copy them.
How to check yourself#
- Delete the virtual machine and set it up again from your own notes.
- Solve tasks like "find a file larger than 100 MB changed in the last week" without searching the internet.
- Explain the
ls -loutput for any file: type, permissions, owner, size. - Play terminal wargames such as OverTheWire Bandit, where each level is unlocked by a password you have to find.
Step-by-step plan
- Week 1 — setupA virtual machine, WSL or a cloud server with Ubuntu or Debian.
- Weeks 2–4 — files and permissionsNavigation, working with files, man, permissions, users and sudo.
- Weeks 5–6 — text and pipelinesgrep, sort, find, redirection; analysing a web server log.
- Weeks 7–8 — the systemPackages, processes, systemd, networking and SSH with a key.
- Weeks 9–12 — scripts and a projectBash scripts, cron, your own server with nginx and backups, described in a README.
Start learning this in your own space
The plan goes into your repository: tick off stages, keep notes — the change history shows how far you have come.
Check yourself
1.Which command prints the path of the current directory?
2.What is the numeric form of the permissions rw-r--r--?
3.The permissions rwxr-xr-x are written as a number. Which one?
Sources
-
LinuxCommand.orgThe free book The Linux Command Line and lessons on the shellfree
-
Ubuntu tutorialsOfficial step-by-step tutorials for the distributionfree
-
OverTheWire: BanditA terminal game where each level teaches a command-line skillfree
-
ShellCheckFinds bugs in shell scriptsfree
Was this helpful?