Bird
0
0

You want to ensure your custom PATH additions in .bashrc are available in all login and non-login shells. What is the best approach?

hard📝 Application Q8 of 15
Linux CLI - Environment and Configuration
You want to ensure your custom PATH additions in .bashrc are available in all login and non-login shells. What is the best approach?
AAdd PATH export only in .bash_profile
BAdd PATH export in .bash_logout
CAdd PATH export only in .bashrc
DAdd PATH export in .bashrc and source .bashrc from .bash_profile
Step-by-Step Solution
Solution:
  1. Step 1: Understand shell types and file loading

    Login shells read .bash_profile; non-login interactive shells read .bashrc.
  2. Step 2: Ensure PATH is set everywhere

    Put PATH export in .bashrc and source .bashrc from .bash_profile to cover both shell types.
  3. Final Answer:

    Add PATH export in .bashrc and source .bashrc from .bash_profile -> Option D
  4. Quick Check:

    Source .bashrc in .bash_profile for full coverage = B [OK]
Quick Trick: Source .bashrc from .bash_profile for consistent PATH [OK]
Common Mistakes:
  • Adding PATH only in one file
  • Using .bash_logout which runs on logout
  • Not sourcing .bashrc from .bash_profile

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes