SkillByAIOpen interactive version →

Lesson 4 / 31

Absolute & Relative Paths

Tell absolute and relative paths apart and use ~, . and .. to point at files quickly.

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
  • ../config
  • config/app.yml
  • /var/log/syslog
Answer

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