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.

Updated
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:

pwd                  # where am I
ls -la               # what is here, including hidden files
cd /var/log          # go to a directory
mkdir -p notes/linux # create directories
cp, mv, rm           # copy, move, delete
less /etc/os-release # read a file page by page

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 -l output 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

  1. Week 1 — setupA virtual machine, WSL or a cloud server with Ubuntu or Debian.
  2. Weeks 2–4 — files and permissionsNavigation, working with files, man, permissions, users and sudo.
  3. Weeks 5–6 — text and pipelinesgrep, sort, find, redirection; analysing a web server log.
  4. Weeks 7–8 — the systemPackages, processes, systemd, networking and SSH with a key.
  5. 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.

Start the plan

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

Was this helpful?

More articles

Programming and IT How to learn Python from scratch Python is a good first programming language: code reads almost like text, and the standard library covers most everyday tasks. This plan takes you from installing the interpreter to your own scripts covered by tests in about four months, at roughly an hour a day. Programming and IT How to learn SQL from scratch SQL is the query language of relational databases. Developers, analysts, testers and managers who want to pull numbers themselves all need it. Basic queries take a few weeks to learn; working confidently with complex reports takes two or three months of practice. Below is the order of topics and ways to train on a real database. Programming and IT How to learn JavaScript from scratch JavaScript runs in every browser and, through Node.js, on the server too. It is easy to start — you can run code right in the browser console — but it has plenty of surprising corners, from type coercion to asynchronous code. The plan below takes three to four months and assumes you already know basic HTML and CSS or are learning them alongside. Programming and IT How to learn Java from scratch Java is a strictly typed language behind banking systems, the servers of large services and Android apps. The strictness slows you down at first, but the compiler catches many mistakes before the program ever runs. This plan takes about six months at an hour a day and leads from your first program to a small backend application. Programming and IT How to learn machine learning from scratch Machine learning means building models that find patterns in data and make predictions from them. Starting with neural networks is tempting, but it is safer to go from the bottom up — from Python and math to classic algorithms, honest evaluation and only then deep learning. Without a technical background, expect six months to a year of regular study. Programming and IT C++ from scratch C++ is a compiled language used wherever speed and direct access to memory matter — game engines, browsers, databases, firmware. It is harder to get into than Python, but you can build your first working program on the very first evening.

More solutions