When it comes to working with the Linux operating system, there are many commands and symbols that can seem a bit confusing at first. One such symbol is the “./” notation. In this article, I will explain what the “./” symbol means in Linux and how it is used in command-line operations.
First of all, let’s start with some basic knowledge. In Linux, the “./” symbol is used to represent the current directory. When you type “./” before a command, you are telling the system to look for that command in the current directory. This can be useful when you have a script or program in the current directory that you want to execute.
For example, let’s say you have a shell script named “myscript.sh” in your current directory. To execute this script, you would typically use the following command:
However, if you are in the same directory as the script, you can simply use the “./” notation to execute it:
Using “./” before the script name tells the system to look for the script in the current directory, instead of searching for it in the system’s default directories.
This can be especially useful when you are working with multiple versions of a script or program. Let’s say you have two versions of a script, “myscript_v1.sh” and “myscript_v2.sh”, both located in different directories. By using the “./” notation, you can easily switch between the two versions by simply changing the current directory.
Another use of the “./” notation is when you want to execute a binary executable file that is located in the current directory. In this case, you would use the following command:
The “./” tells the system to look for the executable file in the current directory and execute it.
It’s important to note that in order to execute a file using the “./” notation, the file must have the execute permission set. You can check the permissions of a file using the “ls -l” command and set the execute permission using the “chmod” command.
In conclusion, the “./” notation in Linux is a simple yet powerful way to execute scripts and programs located in the current directory. By using this notation, you can easily work with multiple versions of a script or program and execute binary executable files without having to specify the full path. So next time you need to execute a script or program in Linux, don’t forget about the “./” notation!
In this article, we explored the meaning and usage of the “./” notation in Linux. We learned that “./” represents the current directory and is used to execute scripts and programs located in the current directory. We also discovered how this notation can be useful when working with multiple versions of a script or program. So the next time you find yourself in the Linux command line, remember the power of the “./” symbol. Happy coding!