Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Getting Started with the Console Reading Files

naman tiwari
naman tiwari
773 Points

what is absolute path?

i didn't understand about absolute path and relative path.

2 Answers

Nathan Tallack
Nathan Tallack
22,159 Points

An absolute path is a path that is the same regardless of what your current working path is and regardless of who you are.

Consider the following three paths. All could point to the same path in the right circumstances.

  • /home/john/data
  • ~/data
  • ./data

The first would be the same no matter where you are and who you are. This is an absolute path.

The second would point to that same path as the first if you were logged in as the user john and your home directory was /home/john (the ~ is a shortcut for your home directory).

The second would point to that same path if your current working directory (the one your shell is in, often shown in your shell prompt before the #) was /home/john

I hope this helps clear it up. :)

in general its a line that consist of all the information required to locate a file or directory in a system