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.
Linux Bashrc File and Usage Examples. Every shell in Linux have some configuration, environment variables, etc. We generally need to change them after opening a new shell.bashrc is used to set shell related configuration during new shell creation. In every new shell.bashrc file is fired before we get the new shell. In this tutorial we will look how to use.bashrc.
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 <=' strong='> 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