01-24-2012 07:27 AM
This is down to the PATH environment variable - i.e. the directories that the shell will look in to execute a command. You can see what it is currently set to using:
So anything in those directories will be searched to execute the command you type.
I'm assuming you are attempting the command you specify as root? For root it is not a good idea to have the current directory on the PATH as it makes it easy for folks to inject trojans into the system by leaving scripts that attack a system in directories with names similar to standard commands. Of course when you are root you get round this by explicitly referencing the current directory by adding ./ to the start of the command.
If you look at standard .profiles for non-root users you will see that often the current directory is added to the PATH as follows:
But it is NOT a good idea to make this change for root.
01-24-2012 01:55 PM
>./ seems do magic in many occasions. What is behind this?
This is elementary shells 101.
As Duncan said, for all commands that are not relative, absolute or builtin, it looks them up in $PATH.
Adding "./" makes the command have a relative path.