[linux] Adding a directory to PATH in Ubuntu

I am a new user of Linux, just switched from Windows. I installed ActiveTcl-8.5 in /opt/ActiveTcl-8.5/, now I want to add its bin directory to the UNIX path.

I have read a number of articles from the net and got confused about which file to modify. My /home/tofayel directory contains .bashrc, .bash_logout, .bash_history, and .profile; but not .bash_login and .bash_profile.

Where do I add the extra lines to add /opt/ActiveTcl-8.5/bin to PATH?

This question is related to linux path

The answer is


Actually I would advocate .profile if you need it to work from scripts, and in particular, scripts run by /bin/sh instead of Bash. If this is just for your own private interactive use, .bashrc is fine, though.


The file .bashrc is read when you start an interactive shell. This is the file that you should update. E.g:

export PATH=$PATH:/opt/ActiveTcl-8.5/bin

Restart the shell for the changes to take effect or source it, i.e.:

source .bashrc

you can set it in .bashrc

PATH=$PATH:/opt/ActiveTcl-8.5/bin;export PATH;