What is the purpose of ~/.bash_profile file
Apart from having a home directory to create and store files, users need an environment that gives them access to the tools and resources. When a user logs in to a system, the user’s work environment is determined by the initialization files. These initialization files are defined by the user’s startup shell, which can vary depending on the release. The default initialization files in your home directory enable you to customize your working environment.
Below are Various Initialization file for Bash Shell
- The /etc/profile file is a systemwide file that the system administrator maintains. This file defines tasks that the shell executes for every user who logs in. The instructions in the file usually set the shell variables, such as PATH, USER, and HOSTNAME.
- The ~/.bash_profile file is a configuration file for configuring user environments. The users can modify the default settings and add any extra configurations in it.
- The ~/.bash_login file contains specific settings that are executed when a user logs in to the system.
- The file is yet another configuration file that is read in the absence of the ~/.bash_profile and ~/.bash_login files.
- The ~/.bash_logout file contains instructions for the logout procedure.
Configuring the .bash_profile File
The .bash_profile file is a personal initialization file for configuring the user environment. The file is defined in your home directory and can be used for the following:
- Modifying your working environment by setting custom environment variables and terminal settings
- Instructing the system to initiate applications