Chapter 01
Your machine
Getting a Unix shell, a package manager, Git and an editor working, and the words for the parts you are using.
Linux distribution
Also called distro, LTS
- What
- A packaged Linux system: the kernel plus a package manager, default tools and a release schedule, such as Ubuntu, Debian, Fedora or Arch. LTS releases get security updates for several years.
- Why
- The distribution decides your package manager and some defaults; the shell and most commands are the same everywhere.
- Example
cat /etc/os-releaseshows your distribution and version.
Watch out
Changing distribution every few weeks instead of learning the shell they all share.
Terminal, shell and prompt
Also called Bash, command line, CLI, shell, prompt
- What
- The terminal is the window. The shell, such as Bash or zsh, reads your commands, expands patterns and runs programs. The prompt is the text the shell prints while waiting, often showing user, host and folder.
- Why
- Knowing which is which tells you where a problem lives: a display issue is the terminal, a "command not found" is the shell and PATH.
- Example
- In
ls -la ~/code,lsis the program,-laare options and~/codeis an argument.
Watch out
Copying the $ prompt sign from a tutorial along with the command.
System package manager
Also called package manager, apt, dnf, pacman, brew
- What
- The tool that installs, updates and removes software from trusted repositories: apt on Ubuntu and Debian, dnf on Fedora, pacman on Arch and Homebrew on macOS.
- Why
- Installing through it keeps every tool updatable and removable, and avoids random installers from download pages.
sudo apt update && sudo apt upgrade # Ubuntu, Debian
sudo dnf upgrade # Fedora
sudo pacman -Syu # Arch
sudo apt install git curl jq treeWatch out
Installing without updating the package list first and getting "unable to locate package".
man, --help and tldr
Also called manual page, man page
- What
man cmdopens the full manual (search with/, quit withq),cmd --helpprints a summary, andtldr cmdshows short practical examples.- Why
- Looking things up in the terminal is faster than searching the web and is always right for the version you have installed.
Watch out
Running a pasted command you have not looked up, especially one with sudo, rm or a pipe into a shell.
Git configuration
Also called git config, .gitconfig
- What
- Settings stored in
~/.gitconfigfor all repositories, or.git/configfor one. Name and email are required before committing. - Why
- The email links your commits to your GitHub profile, and sensible defaults save typing and surprises.
git config --global user.name "Sara Khan"
git config --global user.email "sara@example.com"
git config --global init.defaultBranch main
git config --global core.editor "code --wait"
git config --global pull.rebase false
git config --list --show-originWatch out
On Windows, configuring Git only on the Windows side while you commit from WSL, which has its own config.
VS Code and the code command
Also called VS Code, Visual Studio Code, code command, code ., Remote - WSL, Remote - SSH
- What
- Visual Studio Code is a free editor. The
codecommand opens files and folders from the terminal; the WSL and Remote SSH extensions run VS Code's server where the files live. - Why
- Opening projects from the terminal keeps you in the right folder, and remote extensions let you edit WSL or server files as if they were local.
code .
code notes.md
code --wait msg.txtWatch out
On Windows, opening a WSL project through a \\wsl$ path in plain VS Code instead of the WSL extension.