I would like to edit my .bash_profile file. However it appears that in Ubuntu (and perhaps other Debian distros) this is named as .profile.

However I cannot seem to find the expected variables like $PATH, $PS etc. in the .profile file. The .bashrc file doesn't seem to do any good either.

I am wondering how I can possibly modify my environment variables in this case.

  • Shell startup files tend to be on the far side of "distro-specific". Or near side, depending on which side you're on. – Ignacio Vazquez-Abrams Jul 2 '13 at 6:03
  • 1
    Have you looked at /etc/profile? It is sourced first... – user18838 Jul 2 '13 at 6:07
  • @jasonwryan yes I did. In my '/etc/' there is a file named 'profile' which is documented as '/etc/profile: system-wide .profile file for the Bourne shell (sh(1))' but I do not see any explicit assignment of environment variables. There is also a profile.d directory but it doesn't seem to have anything useful. – DBS Jul 2 '13 at 6:19
  • Probably I should add I am using Ubuntu 12.10. – DBS Jul 2 '13 at 6:21

According to the Ubuntu documentation, they do not recommend using ~/.profile, instead they recommend using ~/.pam_environment for adding items to $PATH:

~/.pam_environment - This file is specifically meant for setting a user's environment. It is not a script file, but rather consists of assignment expressions, one per line.

You can configure your environment variables such as $PATH or $PS permanently for bash sessions in your .bashrc file that is your $HOME directory.

if you need to set it permanently, and system wide (all users, all processes) add set variable in /etc/environment

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