How to reload PATH in linux mint without logging out from system
Solution 1
~/.profile
gets read on login only. When you start a new shell it reads ~/.bashrc
.
See https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html for more details.
Solution 2
You don't need to restart your computer. Just restart X CTRL+ALT+Backspace
Kranach
Updated on June 15, 2022Comments
-
Kranach almost 2 years
I keep all my env variables in ~/.profile file, so they get exported when I open new shell. Recently I had to modify one of PATH parts, to downgrade from Hadoop 2.6.0 to Hadoop 2.3.0. So, my .profile looks like that (i commented out 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 doing this change, I closed and re-opened terminal but without any effect - the PATH still contains hadoop 2.6.0 entry. I tried doing
source ~/.profile
, but it only appends new entries to PATH, without replacing old one. What should I do to make changes to PATH visible then, without having to close all my windows and re-logging? -
Kranach about 9 yearsVery cunning, but by "restarting PC" I meant "not having to close all my apps and browser" Updated the question...
-
Kranach about 9 yearsSoo, the answer is.. not possible? And do mv .profile .bashrc to avoid pain in the future?
-
Yavor about 9 yearsHehe :) You could also try CD to your home dir, and run ". .bashrc" or "source .bashrc" to reload your bash environment.
-
Maxim Egorushkin about 9 years@Kranach Put those exports into your
~/.bashrc
. Source~/.bashrc
from your~/.profile
.