The terminal of the Linux system is a command-based user interface. You provide your commands into the terminal, and the shell then executes your command and performs the task your command specified.
Many a time, while running some command, you may have observed the ./ present. However, you couldn’t figure out what does the ./ mean. Here we’ve explained what does the ./ mean in the Linux systems and where it’s used.
Also read: How to get the current working directory in Python?
Meaning of ./ in Linux
To understand the meaning of ‘./’, let’s break it into ‘.’ and ‘/’.
The ‘.’ means the present working directory where you are right now.
The ‘/’ means that you are looking for a directory and not working for a file.
Therefore ./ means inside your current directory.
The ‘ls’ command gives the list of the files and directories present in your current working directory unless some specific directory name is given to it.
As we can see in the image above, the present working directory is ‘Candid.Technology’. When we do a ‘ls -l’ we can see the contents of the directory ‘Candid.technology’. Now, when you give the command ‘ls -l ./’, the output displays the contents of the Candid.Technology directory.
Thus, the ./ refers to nothing else but the current working directory.
Where ./ is used in Linux?
The ./ is generally used to specify the file path or the directory path in a relative way. Let’s understand the example given below to gain more insights.
As you can see in the image above, the present working directory is Candid.Technology. Now, you want to copy a file ‘Hello.txt’ from the home directory to a directory ‘example’ present inside your current directory without changing your current working directory. Here, you can use the ‘./’ to specify the file path.
The path ‘./example/Copied_Hello.txt’ specifies that there is a directory called example in the current working directory (./), where you need to copy the Hello.txt file as Copied_Hello.txt. Thus, by using ‘./’, you specified the relative path for the destination of the copied file, and your current working directory also remained the same.
Therefore, you can use ‘./’ in Linux to specify your current working directory and use it in relative paths to use some files without changing the current working directory.
Also read: How to install Ubuntu on Windows?
Very well written with useful information.