I ran these 2 commands simply in the terminal:

export PATH="$PATH:/home/milkncookiez/Developer/android-studio/bin"
export PATH="$PATH:/home/milkncookiez/Developer/PhpStorm/bin"

in the 2 bin folders I have the files studio.sh and phpstorm.sh. In that same terminal session when I simply wrote the name of the files - the programs were ran.

When I opened another terminal - did not work. I added these both lines in the ~/.profile file, opened a new terminal session but it still does not work. How do I set the 2 variable changes to be permanent for all terminal sessions?


2 Answers 2


Adding them to ~/.profile (apply to your user) or a /etc/profile.d/*.sh file (apply to the entire system) is the correct way. In order for the change to apply, you have to log out of your system and log back in, as ~/.profile and /etc/profile.d/*.sh are loaded when you login.

To 'reload' ~/.profile in a running terminal, you can use source ~/.profile

  • /etc/profile should preferably not be edited directly. Better to add a new /etc/profile.d/<somename>.sh file. Anyway, given the paths added to PATH in this case, ~/.profile is probably the suitable choice. Nov 20, 2014 at 9:10
  • @Gunnar I'm not familiar with the /etc/profile.d directory so I can't confirm whether that's the case or not, but please edit my answer if using /etc/profile.d is best practice.
    – Tobias
    Nov 20, 2014 at 9:23
  • Ok, done. The source is the tutorial EnvironmentVariables, and I edited that section in consultation with experienced Ubuntu developers. Nov 20, 2014 at 10:34

You don't need to use export; the PATH variable is already exported at that point. Anyway, .profile is read when you log in, so what you've done is correct, but opening a new terminal does not count as logging in.

  • I habitually use export when dealing with environment variables in ~/.profile. It's true that it's not necessary when modifying an already existing environment variable such as PATH, but I'm probably not going to do it otherwise in the future. That way I eliminate the risk for forgetting export when it's needed. ;) Nov 20, 2014 at 10:42

Not the answer you're looking for? Browse other questions tagged .