Home > Linux > Meaning of dot slash (./) in Linux

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

sh test.sh

if your script is in directory from which you execute command, or

sh /home/user/test.sh

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.

About these ads
Categories: Linux Tags: , , , , ,
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.

Get every new post delivered to your Inbox.

%d bloggers like this: