tags : Linux

Config files

  • .bash_profile and .bashrc are specific to bash
  • Whereas .profile is read by many shells in the absence of their own shell-specific config files.
  • .profile was used by the original bourne shell.

Login shells (eg. ssh sessions)

  • .bash_profile or .profile is read by login shells, along with .bashrc
  • tmux by default runs login shells when you open new panes/windows, you can configure it to spin non-interactive shells
  • It login shells, .bashrc is not automatically sourced, .profile or .bash_profile needs to source it

Sub shells/Non-interactive shells

  • .bashrc is for non-login shell.
  • But for subshells, .bashrc is executed automatically
  • subshells inherit the parent(login shell’s) environment. So you’d not want to keep setting env vars again and again, so you’d set them in .bash_profile