Menu
CoddyTech

Absolute vs Relative Paths

Part of the Fundamentals section of Coddy's Terminal journey. Lesson 7 of 82.

When navigating the filesystem, you can refer to a location in two ways: using an absolute path or a relative path.

Absolute Path: starts from the root of the filesystem (/). It always points to the same location no matter where you currently are:

cd /home/documents

An absolute path always begins with /.

Relative Path: starts from your current directory. It depends on where you are right now:

cd documents

If you are currently in /home, this will take you to /home/documents.

Comparing the two:

  • If you are in /home and want to go to /home/documents:
    Absolute: cd /home/documents
    Relative: cd documents
  • If you are in /home/documents and want to go up one level:
    Absolute: cd /home
    Relative: cd ..

Special relative path symbols:

  • .. Refers to your current directory
  • ... Refers to the parent directory (one level up)
cd ./documents   # same as: cd documents
cd ..            # go up one level
challenge icon

Challenge

Beginner

Navigate to the documents folder using a relative path, then print your current location using pwd.

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals

Practice on your own: Terminal playground