A developer needs to add a directory, /opt/custom-app/bin, to their PATH environment variable. This modification must be applied only when they initiate a login shell, such as through an SSH connection or a text console login. The change should only affect this specific developer's account. Which file in the user's home directory should the developer edit to meet this requirement?
The correct answer is ~/.bash_profile. This file is read and executed by the Bash shell when a user starts an interactive login shell. This is the appropriate place for user-specific configurations that should run only once per login session, such as modifying the PATH variable.
~/.bashrc is incorrect because it is executed for interactive non-login shells, such as when a new terminal window is opened within a graphical session.
/etc/profile is incorrect because it is a system-wide configuration file that applies to all users, not just a specific user. The scenario requires a user-specific change.
/etc/bash.bashrc is also incorrect as it is a system-wide configuration file for non-login shells, and its usage can vary between distributions.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the difference between ~/.bash_profile and ~/.bashrc?
Open an interactive chat with Bash
Why is /etc/profile not suitable for user-specific changes?
Open an interactive chat with Bash
How does adding a directory to PATH in ~/.bash_profile work?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .