We are no longer accepting contributions to Documentation. Please see our post on meta.

Bash

File execution sequence All Versions

0.99
1.01
2.0
2.02
2.03
2.04
2.05b
3.0
3.1
3.2
4.0
4.1
4.2
4.3
4.4

.bash_profile, .bash_login, .bashrc, and .profile all do pretty much the same thing: set up and define functions, variables, and the sorts.

The main difference is that .bashrc is called at the opening of a non-login but interactive window, and .bash_profile and the others are called for a login shell. Many people have their .bash_profile or similar call .bashrc anyway.

This draft deletes the entire topic.

Examples

  • 2

    .profile is read by most shells on startup, including bash. However, .bash_profile is used for configurations specific to bash. For general initialization code, put it in .profile. If it's specific to bash, use .bash_profile.

    .profile isn't actually designed for bash specifically, .bash_profile is though instead. (.profile is for Bourne and other similar shells, which bash is based off) Bash will fall back to .profile if .bash_profile isn't found.

    .bash_login is a fallback for .bash_profile, if it isn't found. Generally best to use .bash_profile or .profile instead.

Please consider making a request to improve this example.

Syntax

Syntax

Parameters

Parameters

Remarks

Other files of note are:

  • /etc/profile, for system-wide (not user specific) initialization code.

  • .bash_logout, triggered when logging out (think cleanup stuff)

  • .inputrc, similar to .bashrc but for readline.

Still have a question about File execution sequence? Ask Question

Topic Outline


    We are no longer accepting contributions to Documentation. Drafts cannot be modified.