AnswerBun.com

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

Ask Ubuntu Asked by Iliyas Mansons on January 3, 2022

.bashrc and /etc/bashrc

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

2 Answers

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.

Update: More distributions

/etc/bash.bashrc has been adopted beyond Debian circles as comments indicate its usage in distros like Arch Linux, MSYS2 and thereby Git Bash.

Answered by John1024 on January 3, 2022

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

Answered by Iliyas Mansons on January 3, 2022

Add your own answers!

Related Questions

Are there any Lubuntu server version?

2  Asked on December 13, 2020 by emoji

   

Can’t connect to local MySQL server through socket problem

0  Asked on December 13, 2020 by silver-dangeros

       

Multiple monitors with KVM

2  Asked on December 13, 2020 by klequis

     

Drive Formatting – Not Operational

0  Asked on December 13, 2020 by dankynanky

     

How to see full cron log (Not of just 1 day or less)?

3  Asked on December 13, 2020 by sagun-shrestha

       

Bluetooth stops working after suspend in 20.04

1  Asked on December 12, 2020 by vox

         

How do I disable automatic screen locking in Xubuntu?

7  Asked on December 12, 2020 by bob-brunius

     

Is Swap File slower than Swap partition in Ubuntu 20.04

1  Asked on December 12, 2020 by aadithya-sathya

         

Logging in to ubuntu with lid closed

0  Asked on December 12, 2020 by fredrik-nilsson

     

Keyboard periodically stops working in Ubuntu 20.04

1  Asked on December 12, 2020 by pfrances

     

VS Code: No PHP executable is set

0  Asked on December 12, 2020 by johann-van-vuuren

       

Wifi not working in ubuntu 20.04

0  Asked on December 12, 2020 by anxiousconcert

       

Error: tcl.h not found (no such file or directory)

2  Asked on December 11, 2020 by goncalo

     

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP