Navigating the file system

Video may be blocked due to browser extensions. In the article you will find a solution to this problem.

Important note

There are two types of paths:

  • Absolute path
  • Relative path

Absolute path shows the location of a folder or a file from the root directory /. In other words, it's a complete path from the very beginning of the filesystem to the target. Examples of absolute paths:

  • /Users/john/Documents/report.pdf
  • /home/craig/photos

Relative path shows the location of a folder or a file from the working (current) directory. For example, if you're in /Users/john/ right now, then Documents/report.pdf is a relative path.

This is similar to a complete postal address (3500 Deer Creek Road. Palo Alto, CA 94304, United States of America — absolute path), or a incomplete postal address (5th ave., 12 — relative path, relative to the city you're in).

Lesson notes

  • 'working directory' is your current directory
  • cd is used to move
  • Unix-based file systems look like trees, with a root directory in the very beginning.
We teach programming in a new way. Check out "Intro to Programming" course.


Learn about why Hexlet is so good →