Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem with $PATH export. The only place I found where I modify $PATH is /etc/environment:


But when I type in terminal echo $PATH it returns:


I don't have /usr/lib/jvm/jdk1.7.0/bin directory so I don't understand why my $PATH export doesn't works and where does /usr/lib/jvm/jdk1.7.0/bin come from.

Also $ANDROID_HOME and $PROJECT_HOME exports correctly; only $PATH export doesn't work.

Can anyone help me?

share|improve this question
You actually used EXPORT in /etc/environment? If so shame on you ... it is a plain text file. – Rinzwind Jan 22 '14 at 10:45
I removed EXPORT, still doesn't work – pstrag Jan 22 '14 at 10:51
I don't think that was rinzwind's intention - you should be placing those types of exports in $HOME/.bashrc or $HOME/.zshrc or whichever shell dotfile corresponds to your environment. If this needs to propagate to new user accounts, place it in /etc/skel/ in the appropriate dotfile. – lazyPower Jan 22 '14 at 11:11
I've tried this earlier (with .bashrc and with .profile) and also didn't work – pstrag Jan 22 '14 at 11:20

There are a few places where you can define $PATH:

  • /etc/environment is a plain text file (not a script) that affects all users
  • ~/.pam_environment - the same thing but user-specific

bash also executes some scripts which can be used for modifying $PATH:

  • ~/.profile is executed for a login shell sessions (don't ask me what it means :)
  • ~/.bashrc is executed for non login interactive shell sessions
  • /etc/profile and /etc/bash.bashrc are system wide alternatives for ~/.profile and ~/.bashrc

I read somewhere that /etc/environment is a recommended place for defining your $PATH. So I usually use it. But your path is probably modified in one of the other places.

BTW, when you execute a command with sudo, I think it normally uses root user's $PATH (and not the $PATH of your unprivileged user account). So, ~/.pam_environment, ~/.profile and ~/.bashrc in /root directory may also play a role.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.