Bootstrap FreeKB - Linux Files - Understanding the BASH and Profile files
Linux Files - Understanding the BASH and Profile files

Updated:   |  Linux Files articles

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



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee


Add a Comment

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