Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

ANDROID_HOME="/opt/ADT/adt-bundle-linux-x86_64-20130522/sdk"
PROJECT_HOME="/home/tomaszchabinka/Dokumenty/tempFile/android_stb"
PATH="/opt/gradle-1.10/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

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

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/jdk1.7.0/bin

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 at 10:45
    
I removed EXPORT, still doesn't work –  Tomasz Chabinka Jan 22 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 at 11:11
    
I've tried this earlier (with .bashrc and with .profile) and also didn't work –  Tomasz Chabinka Jan 22 at 11:20

1 Answer 1

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

 
discard

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.