Linux .bash_profile File - LinuxTect
Maybe your like
The bash shell provides a lot of features that can be configured by using bash configuration files like /etc/profile , ~/.bash_profile , ~/.bash_login etc. The .bash_profile file is located in the current user home directory as a hidden file. In some distributions may use the ~/.bashrc according to the .bash_profile file. In this tutorial, we examine how to find the bash profile file and create it if it doesn’t exist.
Bash Configuration Files
Bash provides different configuration files. The /etc/profile file is used by all users in a Linux system and first, these configurations are applied to the bash shell. And the .bash_profile is located under every user home directory where every user may have different bash configurations. This configuration file overwrites over /etc/profile configuration.
Create .bash_profile File
By default, the .bash_profile is not created by most of the Linux distributions. Actually, the .bash_profile is a normal text file that contains bash configuration like regular bash commands. We can create .bash_profile file like below.
$ touch ~/.bash_profileThe previous command only creates the .bash_profile file but does not open it to make some changes and configurations. Alternatively following command can be used to create if not exist and edit the .bash_profile file.
$ nano ~/.bash_profileConfigure .bash_profile File
Bash provides a lot of features even a programming language. All of them can be configured via a bash shell. Also, the .bash_profile file is used to configured newly opened bash shells or terminals. For example, the command prompt is set with the PS1 environment variable and the bash shell command prompt can be changed by setting a new value for the PS1 environment variable in the .bash_profile file.
export PS1 = "$ "Open Another User Bash Profile File
The tilda ~ is used to locate the current user home directory but what if we need to open another user bash profile file. We can use the absolute path of the .bash_profile file. In the following example, we open the user ismail bash profile file.
$ vim /home/ismail/.bash_profileBackup Bash Profile File
Bash profile file changes over time and if there is a big change this may break the profile file. Taking backup of the bash profile file regularly is a good habit. It is very easy to take a backup of the bash profile file. Generally the name .bash_profile.bak is used as the backup file name for bash profile.
$ cp ~/.bash_profile ~/.bash_profile.bakSystemwide Profile File “/etc/profile”
The /etc/profile file is used as a system-wide profile file where before loading a user-specific profile file this profile file is executed and applied. This system-wide profile file contains checks about shell type, user ID, and loading multiple profile files via /etc/profile.d directory.

Tag » How To Open Bash Profile
-
How Do I Edit $PATH (.bash_profile) On OS X? - Stack Overflow
-
How To Manage Your .bash_profile In MacOS - Medium
-
A Simple Guide To Create, Open, And Edit Bash_profile - Linux Hint
-
Bash Profile Mac: What Is It And How It Differs From Bashrc?
-
Where Is My .bash_profile Located? (Mac OS 10.10.5) - Ask Different
-
Bash Profile - Codecademy
-
Creating A .bash_profile On Your Mac - Redfin Solutions
-
How To Edit .bash_profile On MacOSX? - WiseTut
-
Bash Profile Tutorial - Discover Gists · GitHub
-
How To Create A Bash Profile For Your Terminal App - YouTube
-
How To Create, Open And Delete .bash_profile From Mac OS
-
Bash Profile On Mac - One Post For All Information - EaseUS
-
Difference Between .bashrc, .bash-profile, And .profile - Baeldung
-
Bash Profile — Friendly 101 0.1 Documentation