A little explanation:
When you type a command at the prompt, by default Linux will search in the directories contained in the
PATH environment variable. You can see the contents of this variable with:
Using
./ before the command forces linux to run it from the current directory (referenced by the first dot). You could also run it by specifying the full path.
To be able to run a command from anywhere in the system, therefore, you can place it in one of the directories identified in PATH. You will probably find that you have a
bin sub-directory in your home folder, and that this is already in
PATH. If you do not have such a directory, you can create it, and then add the following lines to your shell's config file (if you're using bash, this is
.bashrc which will be in your home folder):
Code:
PATH=${PATH}:/home/<username>/bin
export $PATH
This will be added next time a shell is opened. After adding a new script / command to your bin directory, you may then find you have to run
hash -r to renew the shell's list of command locations.
Rob