Shell Environment Variables

There are specific environment variables that the bash shell uses by default to define the system environment.

The most important environment variable in this list is the PATH environment variable. When you enter a command in the shell command line interface (CLI), the shell must search the system to find the program. The PATH environment variable defines the directories it searches looking for commands.

The PATH environment variable looks like this.

root@dell:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

This shows that there are six directories where the shell looks for commands. Each directory in the PATH is separated by a colon. The PATH also shows the order in which it looks for commands.

The individual directories listed in the PATH are separated by a colon. All you need to do is reference the original PATH value, and add any new directories to the string.

$ PATH=$PATH:/home/buddy/bin

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.