2

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.

Jorge Castro
  • 71,754
DBS
  • 201
  • 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 02 '13 at 06:03
  • 1
    Have you looked at /etc/profile? It is sourced first... –  Jul 02 '13 at 06: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 02 '13 at 06:19
  • Probably I should add I am using Ubuntu 12.10. – DBS Jul 02 '13 at 06:21

2 Answers2

4

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.
PATH DEFAULT=${PATH}:${HOME}/MyPrograms
1

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

Raza
  • 121
  • You really should set environment variables in .bash_profile: see http://superuser.com/questions/183870/difference-between-bashrc-and-bash-profile –  Jul 02 '13 at 07:13