Which bash startup file is executed for non-login interactive shells?

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!

The startup file that is executed specifically for non-login interactive shells is the .bashrc file. This file is designed to configure the behavior of interactive shell sessions that are not initiated as a login shell. When you open a terminal emulator in a graphical desktop environment, for instance, it typically starts as a non-login shell, causing bash to read and execute commands from .bashrc.

The .bashrc file usually contains settings such as environment variable definitions, aliases, and functions that are intended for interactive use. Its purpose is to ensure that your interactive sessions have a customized environment tailored to your preferences.

In contrast, other files like .bash_profile and .bash_login are executed for login shells, which typically occur when you log into a system or switch users. The /etc/profile file is a system-wide configuration file that is applied to all users during login shell sessions, but it does not affect non-login interactive shells in the same way as .bashrc does.

Therefore, for non-login interactive shells, the .bashrc file is the correct configuration file, enabling you to customize your shell environment effectively.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy