Skip to content

Instantly share code, notes, and snippets.

@sharpjs
Last active February 20, 2022 23:44
Show Gist options
  • Save sharpjs/07a064cdbae74a13b1fc160c448a7f67 to your computer and use it in GitHub Desktop.
Save sharpjs/07a064cdbae74a13b1fc160c448a7f67 to your computer and use it in GitHub Desktop.
Bash Startup File Chart

What files will Bash run automatically?

When invoked as bash:

Remote Non-Login Login
Interactive
  • .bashrc
  • .bashrc
  • /etc/profile
  • First one of:
    • .bash_profile
    • .bash_login
    • .profile
  • .bash_logout
Non-Interactive
  • .bashrc
  • $BASH_ENV
  • /etc/profile
  • First one of:
    • .bash_profile
    • .bash_login
    • .profile
  • $BASH_ENV
  • .bash_logout (if exit invoked)

When invoked as sh:

Non-Login Login
Interactive
  • $ENV
  • /etc/profile
  • .profile
  • $ENV
Non-Interactive none
  • /etc/profile
  • .profile

Source: Bash Manual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment