Linux-Noob Forums
How to add a directory to the path and why ./ is b - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html)
+--- Forum: Tips and Tricks (https://www.linux-noob.com/forums/forum-59.html)
+--- Thread: How to add a directory to the path and why ./ is b (/thread-3970.html)



How to add a directory to the path and why ./ is b - Digerati - 2003-12-15


How to add a directory to the path and why ./ is bad

 

By default there is a limited set of directories that are part of the path. This means that only files that are marked executable and in one of these dirs will be able to be run. The other way to run programs not in the path is to provide the full path to the program, or if it is in the current working directory then you put ./ before it e.g. ./progname. Sometime you will want to add a directory to the path, so that programs and scripts can be placed in this dir and run from anywhere on your system.

 

The easiest way to accomplish this is to edit the /etc/profile for system wide changes or ~user/.bash_profile for user based changes. There will be an entry like PATH=$PATH:$HOME/bin and all you will have to do is edit this line. I would recommend not adding the current working directory (./) to the path as this can present a potential security hole. Apache and other programs can access scripts and if they have the ability to address the CWD then they could be accessing programs that have no wish to be run.