Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

.bashrc and /etc/bashrc

What's the difference between /etc/bash.bashrc and ~/.bashrc?

share|improve this question
    
I don't see /etc/bashrc anywhere. – mikewhatever 13 hours ago
2  
See bash's manpage section FILES. – Cyrus 13 hours ago
1  
@mikewhatever , you can find /etc/bash.bashrc . – Iliyas Mansons 13 hours ago
    
@Cyrus I checked the man page FILES section and "bash.bashrc" doesn't appear there only "~/.bashrc" appears. Could you provide link to man page you were looking at? I was looking at Bash Man Page – WinEunuuchs2Unix 13 hours ago
1  
@Cyrus, I've found the answer from the link you've shared! – Iliyas Mansons 13 hours ago

When bash initializes a non-login interactive bash shell on a Debian/Ubuntu-like system, the shell first reads /etc/bash.bashrc and then reads ~/.bashrc.

The reason that /etc/bash.bashrc does not appear in normal bash documentation (such as here or here) is that it is a feature added by Debian and adopted by Ubuntu. As Debian explains it (readme.debian):

  1. What is /etc/bash.bashrc? It doesn't seem to be documented.

    The Debian version of bash is compiled with a special option (-DSYS_BASHRC) that makes bash read /etc/bash.bashrc before ~/.bashrc for interactive non-login shells. So, on Debian systems, /etc/bash.bashrc is to ~/.bashrc as /etc/profile is to ~/.bash_profile.

Thus, /etc/bash.bashrc is documented in the Debian and Ubuntu man pages but not in man pages from other distributions that do not support this feature.

share|improve this answer

System wide initialization file /etc/bash.bashrc and the standard personal initialization file ~/.bashrc if the shell is interactivе.

share|improve this answer

Your Answer

 
discard

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.