102-500 · Question #84
Which of the following files is not read directly by a Bash login shell?
The correct answer is A. ~/.bashrc. ~/.bashrc is skipped by Bash login shells - it is sourced only by interactive non-login shells (e.g., a new terminal tab that inherits an existing session). The distractor choices are all legitimately read by a login shell: /etc/profile (E) is read first as the system-wide…
Question
Options
- A~/.bashrc
- B~/.bash_profile
- C~/.bash_login
- D~/.profile
- E/etc/profile
How the community answered
(68 responses)- A78% (53)
- B1% (1)
- C4% (3)
- D13% (9)
- E3% (2)
Explanation
~/.bashrc is skipped by Bash login shells - it is sourced only by interactive non-login shells (e.g., a new terminal tab that inherits an existing session). The distractor choices are all legitimately read by a login shell: /etc/profile (E) is read first as the system-wide config, then Bash looks for and reads the first of ~/.bash_profile (B), ~/.bash_login (C), or ~/.profile (D) that it finds - so all four distractors are genuine login-shell startup files. Note that many distributions work around this by having ~/.bash_profile explicitly source ~/.bashrc, which is why it feels like login shells read it - but that's indirect, not direct.
Memory tip: Think of the "rc" suffix as "run commands for interactive shells" - ~/.bashrc is the interactive shell's file, while ~/.bash_profile owns the login shell. Login = profile; interactive = rc.
Topics
Community Discussion
No community discussion yet for this question.