What's the difference between `./` and `../` in relative paths
In the file system, relative path means path relative to your current working directory.
The symbols ./
and ../
are used to represent the current directory and parent directory, respectively.
Here's the difference between the two:
./
refers to the current directory. It is often used to specify the location of a file or directory in the current directory. For example, if you are in the directory/home/user/
and you want to access a file calledfile.txt
in the same directory, you can use the relative path./file.txt
.../
refers to the parent directory. It is often used to specify the location of a file or directory in a directory that is one level above the current directory. For example, if you are in the directory/home/user/dir1/
and you want to access a file calledfile.txt
in the directory/home/user/
, you can use the relative path../file.txt
.
In summary, ./
refers to the current directory and ../
refers to the parent directory.
Subscribe to my newsletter
Read articles from Balveer Singh Rao directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by