Basically,
single dot (.) in Linux represents the
current working directory you are in and
double dot (..) represents the
parent directory.
"." and
".." are similar to the hard links as they increase the link count of an Inode, but we also cannot remove them since they’re built into the filesystem. Moreover, hard links to directories are not possible. Hence we cannot exactly refer to them as hard links, and the more accurate term is
“name-inode maps”.
Both the
"." and
".." can be accessed by
ls -a or
ls - all command.
So
./{fileName} refers to a file that infers that we are in our current working directory. The dot (.) operator is also known as
source. In the below example, dot is the command source to read and execute commands from the filename given as argument. So dot operator is a shortcut for the shell’s built-in source command.
# Above is the same as
Contents of script.sh is:
Code:
echo "Ive used (.) to execute"
Double dot(..) refers to the parent directory. It can used in
cd command for moving around directory. A "
.." can also be used in a command line or in a file path to go back one directory. Typing "
cd .. "goes back one directory. For example, if your current working directory is
/home/steve
Using cd .. command changes the current working directory to:
/home
Hopefully, you are now clear with
"." and
".." .