What does '.' mean in a path?

QuestionsQuestions8 SkillsProDec, 19 2025
0107

In Linux, the dot . represents the Current Working Directory.

It is a shorthand way of saying "right here" or "the folder I am currently in."

Here is how it is used and why it matters:

1. Referencing Files in the Current Folder

If you are already inside the /tmp directory and you want to see the hello file, you could type:

cat ./hello

The ./ tells Linux to look for hello starting exactly where you are standing right now.

2. Running Programs or Scripts

This is the most common use for . for beginners. For security reasons, Linux does not automatically look in your current folder for programs to run. If you have a script named myscript.sh in your folder, you cannot just type myscript.sh. You must type:

./myscript.sh

This literally means: "Look in this current directory for the file named myscript.sh and run it."

3. Difference between . and ..

While you are learning about the single dot, you will often see the double dot too:

  • . (Single dot): The current directory.
  • .. (Double dot): The parent directory (one level up).

How to see it in action

If you type this command in your terminal:

ls -a

The -a flag stands for "all." You will notice that . and .. actually appear as entries in every single folder on the system!

Summary: Whenever you see . in a path, just think: "Right here."

0 Comments

no data
Be the first to share your comment!