0.1 The Linux command line, enough to be dangerous

Checked against the Linux man-pages and OpenSSH references, August 2026

What this is and why it exists

Almost every cloud server you will meet runs Linux, and almost none of them has a screen. The command line is not nostalgia — it is the only interface those machines have. You do not need to become a Linux administrator: you need to move around a machine, read a log, change a file and leave without breaking anything.

The vocabulary

  • Shell — the program that reads what you type and runs it; on most servers, bash.
  • Path — a file's address. Absolute paths start at the root, /var/log/syslog; relative ones start where you are standing.
  • Working directory — where you are standing; every relative path is measured from it.
  • Home directory — your own directory, written ~, where you land when you log in.
  • Permissions — read, write and execute bits, held separately for the file's owner, its group, and everyone else.
  • Root — the superuser, allowed to do anything, including the things you did not mean.
  • sudo — runs one command as the superuser instead of logging in as one.
  • Package manager — installs and updates software from the distribution's repositories, dependencies handled.

The mental model

A Linux machine is one tree of files, and everything is in it — documents, configuration, logs, devices. There is no C drive; other disks are grafted onto the tree at a directory. Once that is real to you the commands stop being a list to memorise: each one shows you where you are, moves you, shows a file, or changes a file.

Permissions are the second half. ls -l prints a mode like -rw-r--r--: after the first character, three groups of three, in the order owner, group, others, each showing read, write and execute — the manual's own letters are read (r), write (w), and execute or, for directories, search (x). The numbers people quote are the same thing added up, four for read, two for write, one for execute, one digit per group. So 644 is owner read and write, everyone else read only; 600 is owner only, which is what a private key needs.

The third piece is the honest one about root. Running as root removes every guard rail, and a mistyped path with root behind it is a machine you rebuild rather than repair. Hence sudo in front of the one command that needs it — the manual describes it exactly that way, as letting "a permitted user to execute a command as the superuser or another user, as specified by the security policy". One command, one decision, one line in the log.

Portable operations

Checked against the GNU and OpenBSD manuals for the tools themselves, so they behave the same on any mainstream distribution.

pwd
ls -lah
cd /var/log
less /var/log/syslog
grep -n "error" /var/log/syslog
tail -n 50 /var/log/syslog
tail -f /var/log/syslog
find /etc -name "*.conf" -type f

-l is "use a long listing format", -a is "do not ignore entries starting with ." — the dotfiles holding most configuration — and -h prints sizes "like 1K 234M 2G". Inside less, press q to leave, ShiftG for the end of the file, and a slash followed by a word to search forward. grep -n prefixes "each line of output with the 1-based line number"; add -i to ignore case and -r to read "all files under each directory, recursively". tail -n gives "the last NUM lines, instead of the last 10", and tail -f prints "appended data as the file grows" — that is how you watch a log while you reproduce a fault, and CtrlC stops it. In find, -name matches the base of the file name against a shell pattern and -type f restricts the answer to regular files.

Changing things:

nano /etc/hosts
chmod 600 ~/.ssh/id_ed25519
sudo apt update
sudo apt install nginx

In nano the manual is plain: "with ^S^X you can save the buffer and exit" — the caret is the Control key, so CtrlS then CtrlX. If a machine drops you into vi instead, you need exactly one escape route: press Esc, then type :q! and press Enter to leave without saving. Nobody expects you to learn vi today; they expect you not to be trapped by it.

apt update "is used to download package information from all configured sources"; apt install acts on the packages you name. Debian and Ubuntu use apt, the Red Hat family uses dnf with different subcommands — never assume one distribution's package manager on a machine you did not build.

What you should now be able to explain or do

Say where you are, list a directory including its dotfiles, and read the last fifty lines of a log. Read -rw------- aloud and say who can do what, and why 600 is the right mode for a private key. Watch a log live while something fails, and stop watching. Leave nano, and leave vi. Say in one sentence why you use sudo for one command instead of logging in as root.

Check yourself

An absolute path starts at the root of the single file tree and means the same thing from anywhere; a relative path is measured from your working directory, so it means different things depending on where you are standing.

tail -f on the file — it prints appended data as the file grows. Press CtrlC to stop.

Read and write for the owner, nothing for anyone else. It is what a private key file needs: a key another account can read is a key you have given away.

Esc, then :q! and Enter — quit without writing, so nothing you typed by accident reaches the file.

Because root has no guard rails at all. One command at a time keeps that power scoped to the moment you meant it, and leaves a record of each use.

Go deeper

Back to The Linux command line, enough to be dangerous: work through the checklist