Skip to content
The Chat Archive
Human-written demonstration (OpenAssistant volunteers)· OpenAssistant (human-written) OpenAssistant Conversations (oasst2)

What is the difference between / and ./ at the start of a file path in Linux?

In OpenAssistant data, “assistant” turns were written by human volunteers as demonstrations. They are not model outputs.
  1. User

    What is the difference between / and ./ at the start of a file path in Linux?

  2. Assistant

    /foo/bar is an absolute path, no matter where you call it from. ./foo/bar is a relative path, meaning that if you're in /bar/baz, it will evaluate to /bar/baz/foo/bar.

  3. User

    Can you explain the difference between absolute and relative path more clearly, please?

  4. Assistant

    Absolutely!

    The difference between absolute and relative paths has to do with the operating system's "file hierarchy system". This file hierarchy defines a starting point (known as the "root"), folders contained within that root location, and then files and folders contained within those folders in those folders and in the folders inside of them. This is often called the "directory". It can get more complicated than that, but that's all we need to know to discuss absolute and relative paths.

    The absolute path describes every folder between root and the subject file or folder. For example, the absolute path /bar/baz/foo/bar describes a file or folder named bar, which is contained in a folder named foo, which is contained in a folder named baz, which is contained in a folder named bar, which is contained in the root. An easy way to remember this might be that the absolute path remains "absolute" or "constant" no matter where you reference it from, because it will always start from the top.

    The relative path describes every folder between the starting point and the subject file or folder. This "starting point" might be an absolute path location that the terminal has been directed into, or it might be where the file calling upon this "relative path" is stored. In either case, it only includes folders contained inside the starting point and those folders contained deeper. Using the same example file as above, if my starting point is /bar/baz, then my relative path is ./foo/bar. If my starting point is /bar/baz/foo, then my relative path is ./bar.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.