How to Add a Directory to Your Command Search Path

By | July 17, 2008

Often you need to run something from your directories without entering the full path to your executables. You may also like to customize some of your user settings, as you might know, .bashrc file allows you do do all this stuff.

In order to add a directory to your command search path you need to do the following:

export PATH=${PATH}:/your/path

The export command sets a variable in this script but also “exports” it so it affects things outside this script. The ${PATH} part is a special function that expands to your current search path. The colon (“:”) must be used to separate elements of the search path.

You can add this line to your .bashrc file or run it from your command line if you need to update your command search path only once.

More about .bashrc file possibilities you can read here