Great question! In Linux, the . (dot) character has a specific meaning when used in file paths:
The Current Directory
The single dot . represents the current directory you are currently working in.
Whenever you see ./ at the beginning of a path, it tells the system: "Look right here in the folder I am already in."
Why do we use it?
- Running Scripts or Programs: If you have a script in your current folder, Linux won't run it just by typing its name (for security reasons). You have to type
./script_nameto tell Linux, "Run the file namedscript_namelocated in this current directory." - Relative Paths: It makes it clear that you are referring to a path relative to where you are, rather than searching the whole system.
Another related symbol: ..
While you're learning about the single dot, it's helpful to know about the double dot:
.= Current directory...= The Parent directory (one level up).
Example
If you are inside /home/labex and you want to look at a file in that same folder:
cat ./file1is the same as just typingcat file1.
In your current lab, you are using absolute paths (starting with /), but as you progress, you'll find . helpful for navigating folders more quickly