When it comes to bash configuration files, which of the following will be read/executed when logging into a shell that is considered to be a non-login shell?

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 logging into a shell that is considered a non-login shell, the configuration file that is read/executed is the user-specific one found at ~/.bashrc. This file is specifically designed for interactive non-login shells, and it contains shell commands that set up the environment for the shell session such as aliases, functions, and shell options.

In contrast, the other files serve different purposes. For example, ~/.bash_profile is read when a user logs into a login shell to configure the environment for that session, typically establishing environment variables and executing commands vital for setting up the user’s environment. /etc/profile serves a similar purpose on a system-wide level for all users during login, and ~/.bash_logout is executed when a login shell exits, not a non-login shell. Therefore, ~/.bashrc is the correct answer because it specifically applies to the context of a non-login shell session.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy