Discussion Locked

Newbie Question - Problem with PATH

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Newbie Question - Problem with PATH
I can't get Linux to retain the PATH. I log in as root and update it as follows:

PATH=$PATH:/usr/local/src/prog
export PATH

This keeps the path for a while (a day or so) but after that I loose it. Whatdo I have to do to retain this silly path? Thanks, MB

1 reply

by shanghai sam

There is an easy solution to your problem. Everytime you or your user sets the environment path variable, then logs off, the setting is not kept. There are some script programs that are run when the user logs on or logs off. I assume your shell program is Bash. The scripts are:
/etc/profile - Run for all users when they log on.
$HOME/.bash_profile - Run for a particular user when they log in.
$HOME/.bash_logout - Run when the user logs out.

Depending on what you want to do, you shouldbe able to solve your problem by putting your above statements in /etc/profile or $HOME/.bash_profile. The $HOME directory is the user's home directory in /home/username. See the following URL for a more complete explanation:

http://ctdp.tripod.com/os/linux/usersguide/index.html

Item 19.

This discussion is closed to new replies.