6

I executed.

export PATH=/home/varun/SOFTWARE/MOLDEN/molden5.1:$PATH

In my terminal; followed by which molden

I get the expected output:/home/varun/SOFTWARE/MOLDEN/molden5.1/molden

But this is temporary. When I close my terminal which molden does not give me any response. What should I do? Please help me.

Aaron
  • 6,646
  • 5
  • 34
  • 48
user299774
  • 61
  • 1
  • 1
  • 2

2 Answers2

3

First of all, modifying your $PATH in that way is a temporary change for your current terminal session. Other concurrent or later terminal sessions will not see that change reflected. Add that command to your ~/.profile file if you want it to persist.

Secondly the which command is designed to search the directories in your $PATH. If the link to "molden" is not in your $PATH or (in your case) your $PATH gets reverted, it will not find it. See the which man page for more details.

Aaron
  • 6,646
  • 5
  • 34
  • 48
  • You can also note that, at the bottom of `.profile`, it adds `$HOME/bin` to your path if `$HOME/bin` exists. You can copy and paste that at the bottom and replace both `bin`s in the copy with `SOFTWARE/MOLDEN/molden5.1/`. – Chai T. Rex Feb 15 '17 at 23:04
0

If you're using Ubuntu Desktop (GUI), and you modify ~/.profile, you still won't see the changes reflected in a new graphical/Gnome Terminal because it starts the Terminal as a non-login shell, so it doesn't load ~/.profile. You will have to log out and log back in for it to take effect.

An alternative is to set the path in ~/.bashrc, which is loaded for non-login shells. Then new graphical/Gnome Terminals will reflect the change. This isn't the canonical method, but you won't have to log out and back in.

wisbucky
  • 2,462
  • 27
  • 17