Lesson 4 / 29

Absolute & Relative Paths

Two ways to point at the same file.

Absolute vs relative

An absolute path starts at / and always points to the same place, e.g. /home/alice/notes.txt. A relative path is resolved from your current directory, e.g. notes.txt or ../notes.txt.

Shortcuts: ~, ., ..

~ is your home directory, . is the current directory, .. is the parent.

cd ~/Documents      # go to ~/Documents
cd ..                # go up one level
cd -                 # go to previous directory

Quick check: Which path is absolute?

  • reports/2026.csv
  • /var/log/syslog
  • ../config
Answer

/var/log/syslog — Only paths starting with `/` are absolute; the others depend on the current directory.