Linux – How to reload the PATH in linux mint without logging off from the system

How to reload the PATH in linux mint without logging off from the system… here is a solution to the problem.

How to reload the PATH in linux mint without logging off from the system

I

save all the environment variables in the ~/.profile file, so they are exported when I open a new shell. Recently I had to modify one of the PATH sections to downgrade from Hadoop 2.6.0 to Hadoop 2.3.0. So, my .profile looks like that (I commented out the old HADOOP_INSTALL):

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export GRADLE_HOME=/home/kranach/tools/gradle-2.2.1
#export HADOOP_INSTALL=/home/kranach/hadoop-2.6.0
export HADOOP_INSTALL=/home/kranach/hadoop-2.3.0
export M2_HOME=/home/kranach/tools/apache-maven-3.2.5
export PIG_HOME=/home/kranach/tools/pig-0.14.0
#export HIVE_HOME=/home/kranach/tools/apache-hive-0.14.0-bin/
export HIVE_HOME=/home/kranach/tools/hive12
export HBASE_HOME=/home/kranach/tools/hbase-0.98.10-hadoop2

PATH="$PATH:$GRADLE_HOME/bin:$HADOOP_INSTALL/bin:$HADOOP_INSTALL/sbin:$M2_HOME/bin:$PIG_HOME/bin:$HIVE_HOME/bin:$HBASE_HOME/bin"

After making this change, I close and reopen the terminal but nothing works – PATH still contains hadoop 2.6.0 entries. I tried doing source ~/.profile, but it just appends the new entry to the PATH and doesn’t replace the old one. What should I do to make changes to PATH visible without having to close all windows and log back in?

Solution

~/.profile is only read at login. When you start a new shell, it reads ~/.bashrc.

See also https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html for more details.

Related Problems and Solutions