Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a directory to PATH in Ubuntu [closed]

Tags:

linux

path

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?

like image 981
Tofayel Ahmed Avatar asked Sep 09 '11 11:09

Tofayel Ahmed


People also ask

How do I permanently add a PATH in Ubuntu?

Permanently add a directory to $PATHbashrc file of the user you want to change. Use nano or your favorite text editor to open the file, stored in the home directory. At the end of this file, put your new directory that you wish to permanently add to $PATH. Save your changes and exit the file.


2 Answers

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 
like image 110
Fredrik Pihl Avatar answered Sep 28 '22 03:09

Fredrik Pihl


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.

like image 40
tripleee Avatar answered Sep 28 '22 01:09

tripleee