How to read this guide
Distros differ in package names and service units, but the core GNU/coreutils + iproute2 + systemd stack is consistent on most desktops and servers you will SSH into. Treat commands as verbs with arguments; use man command and command --help when flags vary.
Navigation and inspection
pwd prints your current directory; cd changes it (both are shell builtins on bash). ls -alh shows hidden dotfiles, long listing, and human sizes. Prefer less over cat for large logs so you can scroll and search with /pattern. file path guesses binary vs text so you do not pipe garbage into text tools.
Redirection and pipelines
Stdout is file descriptor 1, stderr is 2. program > out.txt truncates the file; >> appends. Merge streams with 2>&1 after redirecting stdout (order matters). Pipelines (|) connect stdout of the left command to stdin of the right—only stdout by default, so capture errors explicitly when debugging.
Permissions without shooting your foot
ls -l shows owner/group/other bits; id shows your groups. Learn symbolic chmod (u+x) before memorizing octal. Avoid world-writable trees; see the dedicated chmod article when tempted by quick fixes.
Processes, services, and logs
ps aux --sort=-%mem | head is a simple memory snapshot. For long-running services use systemctl status unit and journalctl -u unit -e to follow logs. top or htop helps when CPU is pegged—pair with pidstat when you advance.
Networking you can actually use
Prefer ip addr and ip route over legacy ifconfig. ss -tulpn lists listeners with processes (often needs sudo for other users’ sockets). ping and curl --max-time 5 are gentler first probes than blind port scans on networks you do not own.
Quick reference table
| Area | Commands | Beginner tip |
|---|---|---|
| Files | cp -a, mv, mkdir -p, rm -i | Use -i until deletion habits are boring |
| Text | grep -n, sed -n '1,20p', wc -l | Quote patterns so the shell does not glob them |
| Disk | df -hT, du -sh * | Check mount types before blaming “mystery” space loss |
| Ownership | chown user:group, chmod u+rw | Fix ownership before chmod spam on shared dirs |
Script safety defaults
For bash scripts you write yourself, set -euo pipefail exits on errors, catches unset variables, and surfaces failures hidden in pipelines—combine with meaningful echo messages or trap handlers once scripts grow.
Where to go next
Deep dives on this site cover individual tools in more detail than a single primer allows.
Related: what sudo does on Linux, chmod explained, what chmod 777 means, grep explained, find explained, disk usage commands, systemctl explained, Linux networking commands, netstat and ss, sysadmin essentials, SSH commands, process management, users and permissions.