In Unix, what is my path, and how do I set or modify it?
The PATH environment variable is a colon-delimited list of directories that your shell searches through when you enter a command.
Program files (executables) are kept in many different places on the Unix system. Your path tells the Unix shell where to look on the system when you request a particular program. Having more directories in your path will reduce the number of times you get "Command not found" errors, but might put you at greater risk of activating a Trojan horse.
To find out what your path is, at the Unix shell prompt, enter:
Your path will look something like the following.
You will see your username in place of
the above example path, if you enter the
ls command, your
shell will look for the appropriate executable file in the following
order: first, it would look through the directory
/usr/bin, and finally the local directory, indicated
. (a period).
To modify your path
If you are using
tcsh, at the shell
setenv PATH $PATH\:/dir/path
If you are using
bash, at the shell prompt, enter:
PATH=$PATH\:/dir/path ; export PATH
In all cases, replace
/dir/path with the directory you
want the shell to search.
To make these changes permanent, add the commands described above to
the end of your
.cshrc file (for
.profile file (for
.bash_profile file (for
At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?
This is document acar in the Knowledge Base.
Last modified on 2016-12-06 11:09:42.
- Fill out this form to submit your issue to the UITS Support Center.
- Please note that you must be affiliated with Indiana University to receive support.
- All fields are required.