View Single Post
Posts: 1 | Thanked: 0 times | Joined on Jul 2007
#8
Originally Posted by BcNexus View Post
I believe the '.' before documents is because it's hidden. Hidden files and folders are preceded by '.'

For some reason I don't know of, "./" tells Linux that whatever after "./" is an executable. EG "./foo" tells Linux to run "foo" as an executable file.
As a security measure, you have to specify absolute (full) paths for executables that aren't in your PATH environment variable.

For example, your PATH variable might contain something like "/usr/bin", which would mean that executables in /usr/bin can be run just by typing their name.

However, when you are accessing other places (for example, a user's home directory or a remote network site), you don't want people to be able to override your commands. For example, someone could put a file in their directory called "ls" - chances are someone would probably end up running it.

Forcing you to specify absolute paths eliminates this problem. The admin would have to type "./ls" rather than "ls", which makes it clear that he/she is running THIS executable.

FYI, executables also need to have the execute permission set. You can do this using the command "chmod +x <FILENAME>". If you write scripts (shell scripts, Perl, Python, etc.) and want to run them from the command line as if they were executables, this is how you do it (you also have to add the shebang to the top of the file).