What Do the Single and Double Dots Mean in Directories?

0
4
Asked By CuriousCat99 On

I've noticed that in the file system, there are references for **.** and **..**. I'm curious if these are just applications in every folder that allow you to navigate to the current directory and the parent directory, respectively. Can someone explain what they really are?

3 Answers

Answered By TechieTom22 On

The single dot **(.)** refers to your current directory, while the double dot **(..)** points to the parent directory of wherever you currently are. They aren’t applications; instead, they are default directory entries that help with navigation.

FileFreak47 -

I think it’s important to be precise—**..** is technically the parent, not just 'back.' If you really want to return to the last directory you were in, you'd use **cd -** instead.

Answered By PathfinderPete88 On

You're right that **.** and **..** are links. They are created automatically when you set up a directory. **.** is a hard link to the current folder and **..** is a hard link to the folder right above it, which allows you to navigate using relative paths. For example, **../..** references a file two directories up!

LinkLover23 -

So, basically, **..** gets you up to the parent directory and **.** keeps you in your current spot. Makes sense!

Answered By CodeNinja56 On

Yeah, it’s interesting. When you create a new directory, **.** refers to itself and **..** refers to the directory that contains it. This lets you use relative paths easily and keeps everything organized.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.