As the question asked I thought "." means the current directory so why can't we directly type helloworld to run the program?
1 Answer
Because '.', the current directory, is not in your environment's $PATH, which contains the list of paths where executables get searched. To see your PATH variable, type
echo $PATH This is most likely for security reasons, to prevent execution of local executables named after system or other trusted installed ones. I have worked on systems where '.' was in the PATH and at the very least it lead to some confusing moments (the test utility being a favourite candidate for accidental replacement.)
I would advise against appending '.' to PATH for those reasons.
1 Comment
Some programmer dude
To elaborate on this answer, not having
. in the $PATH is a good thing. Think what would happen if there was a program named ls in the current directory, and you wanted to list file? Then the local ls program would be invoked and not /bin/ls.