↑↓ move Enter open Esc close

Absolute vs relative path

Full address from / versus directions from where you stand.

An absolute path starts at the root and is unambiguous everywhere: /home/diego/notes.txt. A relative path is interpreted from the current working directory: notes.txt, ../photos, ./script.sh.

Two shorthands appear constantly: ~ expands to your home directory (so ~/projects is absolute in disguise), and .. means the parent directory. Scripts should prefer absolute paths: they run from unpredictable directories, especially under cron.

See it in practice

$ cd /var/log && pwd && cd .. && pwd

An absolute jump, then a relative one. Both end somewhere concrete: pwd always tells you where.

Where you'll meet it

Errors that come down to this concept: No such file or directory

Learn these concepts by typing them: the interactive course builds them up lesson by lesson in a real simulated shell.