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

Problem: During Android development, in order to add ADB path to environment variable; I did following things in short-

gedit /etc/environment - Added my desired path in the file such as :/media/Software/00.AndroidLinux/ADT/sdk/platform-tools

But, What I noticed that, adding path to the file has no effect to $PATH until I reboot my Ubuntu.

My question is, How can I add path to /etc/environment variable, and without restarting Ubuntu?, So that I can work with my modified $PATH.

Please Note: I'm new to Ubuntu and learning each day.

share|improve this question
up vote 1 down vote accepted

Strictly speaking you can't since that file is only read on login, by pam_env. You can however source it in your current shell to read in the values.

$ . /etc/environment
share|improve this answer

You can add to your $PATH variable directly like this:

export PATH=$PATH:/the/dir/you/want/to/add

Then, edit /etc/environment.

An alternate method would be to still export as I showed above, but then to add the entry to your ~/.bashrc file (if using BASH shell).

echo "export PATH=$PATH:/the/dir/you/want/to/add" >> ~/.bashrc
source ~/.bashrc

EDIT: Exporting your $PATH in your ~/.bashrc file rather than /etc/environment keeps you from needing to elevate permissions to edit a "global" (system) config file and also keeps other users (if you have any on your system) from having that path auto-added on account creation.

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.