Is there a global .bash_profile for all users on a system?
So I stumbled across svn color and thought it was something useful all our devs would appreciate. The read me for this says to put some code in your ~/.bash_profile
, but I'm wondering how I might include this globally on the server, so it's a default for everyone. Is there some global .bash_profile
I could add this to? Perhaps another way?
To include commands for all users on your system, use /etc/profile
.
From http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files
When Bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
Some distros also read /etc/profile.d/*
by default, and you can put your customizations there. See http://bash.cyberciti.biz/guide//etc/profile.d
Already answered, but thought this might be helpful to others looking.
On Amazon Linux /etc/profile
states:
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
With that in mind, I created a bash_profile.sh
in /etc/profile.d/
.
In that file, I added export PS1=" insert_desired_bash_profile_options "
Don't forget that a logout/in is probably required to pick up the changes.