Linux Files - Understanding the BASH and Profile files

The Bash profile files are used to define environment variables, such as the directories in the $PATH variable and the users default editor, such as vi or nano in the $EDITOR variable. For example, a very simply Bash profile file may contain something like this.

export EDITOR=/usr/bin/vi
export PATH=$PATH:/usr/local/bin


User personal Bash profile file

Each user will have their own personal Bash profile file, like this.

  • /root/.bash_profile
  • /home/john.doe/.bash_profile
  • /home/jane.doe/.bash_profile

The users personal Bash profile file will take precedence over the global, system wide Bash profile file.


Global Bash profile file

On a Red Hat distribution, the global Bash profile file is /etc/profile This file reads scripts in the /etc/profile.d directory. For example, the following script could be used to set the $EDITOR variable to use the vi editor.

  • /etc/profile.d/

The script could contain something like this.

if [ -z "$EDITOR" ]; then
  export EDITOR=/usr/bin/vi



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 f964f in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |