Which configuration file is read first when a login bash shell is executed?

Prepare for the LPI Linux Essentials Exam with multiple choice questions and detailed explanations. Enhance your Linux skills and boost your confidence for the real exam!

When a login bash shell is executed, the first configuration file that is read is /etc/profile. This file contains system-wide settings and configurations that are applied to all users on the system when they log into a bash shell. It sets up the environment for users, defining variables and executing scripts that configure the shell environment before the user-specific configurations are applied.

After /etc/profile is executed, if a user-specific configuration file exists, such as ~/.bash_profile, it would be read to apply personalized settings for that user. The ~/.bashrc file is generally executed for non-login interactive shells and is not read during the initial login process. Similarly, /etc/bash.bashrc applies to non-login shells and is executed for each interactive shell session thereafter. Thus, it is important to recognize that /etc/profile is the foundational configuration file that sets the stage for user-specific configurations upon the initial login.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy