Check out a free preview of the full Introduction to Bash, VIM & Regex course

The "Paths" Lesson is part of the full, Introduction to Bash, VIM & Regex course featured in this preview video. Here's what you'd learn in this lesson:

James demonstrates how to navigate to a file with absolute and relative paths.

Preview
Close

Transcript from the "Paths" Lesson

[00:00:00]
>> James Halliday: The next thing that I wanted to talk about is sort of a little bit more information about how paths work. Because it's kind of important to know how paths work and what the expectations are if the path's in a directory system. So, we've already used things like dot and dot dot a little bit, and tilde.

[00:00:22]
So, paths that use '.' and '..' at the beginning are called relative paths. This also includes something like if you do, if I do like head moby-dick.txt, this is an example of a relative path, because it's relative to the current directory. It's also the same as doing ./ the file, it's also the same as a bunch of, as many dot slashes as you want, cuz it means the current directory.

[00:00:51]
These are all examples of relative paths. Where if I want to do ls ../ also an example of a relative path, because what directory you're in, what your current working directory is, Matters. There's also absolute paths which typically begin with a slash or I guess if you begin a path with tilde that's also an example of an absolute path.

[00:01:16]
And with these paths it doesn't matter where you are in the directory system with the CD commands, they will work. The same from anywhere. And if you want to get the absolute path for the current directory, we've already seen the pwd commands. So if I do ls, that absolutely path, that's the same as doing ls.

[00:01:39]
Or just just ls, okay?

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now