Configuration files

It’s a good assumption that every Linux user will want to define a few aliases, functions, and environment variables to suit his or her needs. However, it’s undesirable to manually enter them upon each login or for each new invocation of bash. To set up these things automatically, bash uses a number of configuration files to set its operating environment when it starts. Some of these files are used only upon initial login, whereas others are executed for each instance of bash you start, including at login time. Some of these configuration files are system-wide files for all users to use, whereas others reside in your home directory for your use alone.

bash configuration files important to Exam 102 are listed in Table 13-1.

Table 13-1. bash configuration files




This is the system-wide initialization file executed during login. It usually contains environment variables, including an initial PATH, and startup programs.


This is another system-wide initialization file that may be executed by a user’s .bashrc for each bash shell launched. It usually contains functions and aliases.


If this file exists, it is executed automatically after /etc/profile during login.


If .bash_profile doesn’t exist, this file is executed automatically during login.


If neither .bash_profile nor .bash_login exists, this file is executed automatically during login. Note that this is the original Bourne shell configuration file. ...

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.