LinuxmacOS

Where Does Bash Store Config and History?

Bash reads startup files and history from your home directory, with login versus interactive shells loading different sets.

Last updated

Bash configuration lives in dotfiles at home. Interactive shells source .bashrc on every start. Login shells source .bash_profile once, which classically chains to .bashrc. History appends to .bash_history per session.

That layering explains most confusion. Terminal emulators usually start interactive non-login shells, so .bashrc does the real work. macOS defaulted to zsh years ago, so these files matter there only after switching shells.

Where Bash stores this, by platform

Linux
~/.bashrc (plus ~/.bash_history)

Interactive shells source bashrc every start. Login shells chain through bash_profile. History appends to bash_history per session.

macOS
~/.bashrc (plus ~/.bash_history)

Default shell is zsh since Catalina, so these files apply only after switching to bash. Same layering rules when active.

Frequently asked questions

bashrc versus bash_profile, which runs?

Interactive shells read .bashrc; login shells read .bash_profile first. Put shared setup in .bashrc and source it from the profile. Duplicated definitions cause double PATH entries.

Notice an outdated path? Let us know.