How to reload PATH in linux mint without logging out from system

12,625

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

Share:
12,625
Kranach
Author by

Kranach

Updated on June 15, 2022

Comments

  • Kranach
    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
    Kranach about 9 years
    Very cunning, but by "restarting PC" I meant "not having to close all my apps and browser" Updated the question...
  • Kranach
    Kranach about 9 years
    Soo, the answer is.. not possible? And do mv .profile .bashrc to avoid pain in the future?
  • Yavor
    Yavor about 9 years
    Hehe :) You could also try CD to your home dir, and run ". .bashrc" or "source .bashrc" to reload your bash environment.
  • Maxim Egorushkin
    Maxim Egorushkin about 9 years
    @Kranach Put those exports into your ~/.bashrc. Source ~/.bashrc from your ~/.profile.