Meaning of dot slash (./) in Linux
A colleague of mine was confused about dot slash command (./) when he was executing some shell scripts.
He was not in the directory where script was and he tried to execute it with ./ command. And of course, terminal couldn’t find his script. He thought ./scriptName was the only way to execute script in Linux. He was wrong of course, but then we started a discussion about people execute commands, get the job done, but in some cases they don’t really know what they are doing.🙂
So, you can execute shell script in a few ways, for example
if you are in the directory where script is, or you can use absolute path( if you are or are not in the directory where script is )
or you can specify the interpreter in the command line like
if your script is in directory from which you execute command, or
if you are not in that directory.
That’s all nice, but let me briefly explain dot slash meaning here.
Dot means current directory, and slash is directory path separator.
And ./ means execute script from my current directory.
Dot (.), or current directory is never on the PATH ( echo PATH to check this ) for security reasons and it never should be.