A system administrator wants to permanently add a custom script directory, /opt/custom_scripts, to the PATH environment variable for their user account. The new path should be available every time they start a new login shell, such as when connecting via SSH. Which file is the most appropriate place to add the export PATH=$PATH:/opt/custom_scripts command to meet this requirement?
The correct option is ~/.profile. This file is executed for login shells, making it the appropriate location for user-specific environment variable initializations that should occur at login, such as when connecting via SSH. ~/.bashrc is typically executed for interactive non-login shells, such as opening a new terminal in a desktop environment. /etc/profile is a system-wide configuration file that affects all users and is not appropriate for a single user's configuration change. ~/.bash_logout is executed when a login shell exits, not when it starts, so it would not be used to set variables for the session.
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 purpose of the `~/.profile` file?
Open an interactive chat with Bash
How is `~/.bashrc` different from `~/.profile`?
Open an interactive chat with Bash
Why isn't `/etc/profile` a good choice for user-specific changes?
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 .