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...
IT & Cybersecurity Package Join Premium for Full Access