Understanding the BASH and Profile files

Home > Search
  by

BASH Runtime Configuration​

The BASH Runtime Configuration file is located at ~/.bashrc. The BASH Runtime Configuration file is the first file that is executed when launching a new shell (aka Terminal). The ~/.bashrc file typically only contains a few lines of text, and most lines are commented out.

 


System wide

After the BASH Runtime Configuration file is executed, next, one of the following files are executed:

  • /etc/bash.bashrc
  • /etc/profile
  • /etc/environment

Distributions based off Debian typically use the /etc/bash.bashrc or /etc/environment file. Distrubutions based off Red Hat typically use the /etc/profile file. These files typically contain quite a few lines of text. The information in these files apply to every Terminal, regardless of what user account is being used.

 


User specific

Regardless of the distribution being used, next the ~/.bash_profile, ~/.bash_login, and ~/.profile files are exected, in that order. The first of these 3 files that exists is used to determine how the shell will behave. These files can contain user specific variables, meaning that the information in these files only applies to the current user.

 


Logout

As the name of the file implies, the ~/.bash_logout file is the script that cleans up once you exit the Terminal.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments