系统上的所有用户是否有全局的.bash_profile?

所以我偶然发现了svn的颜色 ,认为这是我们所有的开发者都会喜欢的东西。 阅读我说的是把一些代码放到你的~/.bash_profile ,但是我想知道如何在服务器上全局地包含这个代码,所以这是每个人的默认设置。 是否有一些全球.bash_profile我可以添加到? 也许另一种方式?

要包含系统中所有用户的命令,请使用/etc/profile

http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files

当Bash作为交互式loginshell或者作为具有–login选项的非交互式shell调用时,它首先从文件/ etc / profile中读取并执行命令(如果该文件存在)。 读取该文件后,它将按照该顺序查找〜/ .bash_profile,〜/ .bash_login和〜/ .profile,并从第一个存在并读取的第一个中读取和执行命令。

有些发行版默认还会读取/etc/profile.d/* ,您可以将自定义设置放在那里。 请参阅http://bash.cyberciti.biz/guide//etc/profile.d

已经回答,但认为这可能有助于其他人看。

在Amazon Linux /etc/profile状态下:

 # 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. 

考虑到这一点,我在/etc/profile.d/创build了一个bash_profile.sh

在那个文件中,我添加了export PS1=" insert_desired_bash_profile_options "

不要忘记,注销/ in可能需要拿起更改。