EX200 Essential Tools Practice Question
A user wants to set an environment variable named 'EDITOR' to the value '/usr/bin/vim' so that it is available in all future login sessions. Which file should the user add the export command to?
⚠ Common exam trap
Red Hat often tests the distinction between login and non-login shell startup files, and the trap here is that candidates mistakenly choose ~/.bashrc because they associate it with user-specific settings, not realizing it is not sourced by login shells.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
~/.bash_profile
The ~/.bash_profile file is executed for login shells, making it the correct place to set environment variables like EDITOR that should persist across all future login sessions. Adding 'export EDITOR=/usr/bin/vim' to this file ensures the variable is defined each time the user logs in.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
~/.bash_logout
Why it's wrong here
~/.bash_logout is sourced by Bash when a login shell exits, not when it starts. Its purpose is cleanup, such as clearing the terminal or removing temporary files, and any variables set there would only affect the brief logout process. Because it runs at the end of the session, it cannot establish an environment variable for the user's ongoing shell sessions, making it incorrect for setting editor.
- ✓
~/.bash_profile
Why this is correct
When a user logs in, Bash reads ~/.bash_profile as the user-specific startup file for login shells, which is exactly when persistent environment variables should be defined. Exporting editor in this file makes it available to the shell itself and to all child processes launched during that session, ensuring the setting is inherited system-wide from a user perspective. This is the canonical location for setting per-user environment variables.
- ✗
/etc/bashrc
Why it's wrong here
/etc/bashrc is a system-wide configuration file that affects every user on the machine, not just the individual user. Changing it to set editor would impose the variable on all accounts, which is usually undesirable and requires root privileges. While it could technically serve as a global default, the question asks about a user's environment, and /etc/bashrc is not the user-specific mechanism, so it is wrong for this scenario.
- ✗
~/.bashrc
Why it's wrong here
~/.bashrc is read by interactive non-login shells, such as when a new terminal window is opened inside a desktop session, not by the initial login shell. Setting editor there might appear to work in interactive terminals, but it will not be exported into the environment of scripts, cron jobs, or desktop-launched applications unless the file is explicitly sourced by the login shell. Since the correct login-shell file for persistent environment variables is ~/.bash_profile, relying on ~/.bashrc is incorrect here.
Go deeper
Related to this question
About these practice questions
One of 427 original EX200 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This EX200 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX200 exam.