Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

On linux there's usually a global bashrc file (/etc/bash.bashrc or /etc/bashrc). On FreeBSD however bash doesn't seem to support this feature. What's the best way to add a system-wide bashrc then?

share|improve this question
up vote 1 down vote accepted

You can try with strings and see which paths are included in the binary.

Anyway, in RHEL5 the only system-wide config file for bash is /etc/profile and there is no /etc/bashrc nor others.

share|improve this answer
Yes, /etc/profile is also a systemwide initialization file (same on freebsd). But it's executed for login shells, and not interactive shells. Anyway, the trick with strings is great! – eugene y Aug 25 '10 at 13:35
You are correct for /etc/profile, but even in RHEL5 (bash 3.2.25) there is no trace of any other bash initialization file in /etc/. – Dan Andreatta Aug 25 '10 at 13:50

There appears to be no common startup file for interactive non-login shells for Bash on FreeBSD. You will have to add something like:

. /etc/bash.bashrc

to the beginning of each user's ~/.bashrc.

share|improve this answer

This one had me thinking for a bit, so I checked out the bash installations I have on my solaris (9 and 10) and FreeBSD servers. Turns out, that the only place that bash looks for bashrc is ~/.bashrc.

The thing is, this isn't just a Solaris or FreeBSD thing. I checked the man page and the only profile stuff checked is the /etc/profile or the various files in the user's home dir. So, the likely culprit is distro customization. So, on the linux servers -- Centos, in this case --

From ~/.bashrc :

# Source global definitions
  if [ -f /etc/bashrc ]; then
    . /etc/bashrc
share|improve this answer
The default ~/.bashrc also has a section like this on Debian 7, although /etc/bash.bashrc is called even if that section is left out. – Time Sheep Dec 8 '14 at 19:33

Check /usr/local/etc/ directory and link it with /etc/ if needed.

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.