Why we use ./ instead of just typing its name when running the script? [duplicate]

when we run a normal command we just type the name of it but why we use ./ instead of just typing its name when running the script?


When you run a shellscript or some other program that is in the current directory, you use

./scriptname

because . denotes the current directory.

When a shellscript or some other program is in a directory in PATH, it is enough with its name for the system to find it,

program-in-path

You can watch PATH with

echo $PATH

You can put own programs into ~/bin (create your own 'bin' and put your own programs there) and it will be found by you, or put it into /usr/local/bin and it will be found by all users.