Reading from afar

You don't have to walk somewhere to read a file there. A path can point at it from anywhere:

  • Relative: ../../south/river.txt climbs two levels, then goes down into south.
  • Absolute: /lab/navigator/north/compass.txt works from any directory.

cat FILE prints a file's contents.

cat ../../south/river.txt
cat /lab/navigator/north/compass.txt

Which one should you use? Relative paths are short and work wherever you copy the whole tree. Absolute paths are unambiguous, which is why scripts and config files prefer them.