Difficulty: Easy
Correct Answer: .profile
Explanation:
Introduction / Context:
When a user logs into a Unix system using a Bourne-compatible shell, the shell reads certain startup files to set environment variables, PATH, aliases, and other customizations. Recognizing which file is responsible is essential for troubleshooting login behavior and configuring user environments.
Given Data / Assumptions:
Concept / Approach:
The classic Bourne shell reads $HOME/.profile
for login shells. Korn shell also reads it; bash reads ~/.bash_profile
or ~/.profile
if the former is absent for login shells. Other files like .exrc
configure vi, and .mbox
is a mailbox file.
Step-by-Step Solution:
.profile
is sourced.Recognize alternatives: bash-specific files may take precedence, but .profile
remains the generic answer.Select .profile
as correct.
Verification / Alternative check:
Run echo $SHELL
to identify the shell. For bash, check man bash
under INVOCATION; for sh/ksh, consult their manuals. You will see .profile
mentioned for login shells.
Why Other Options Are Wrong:
.profile
is correct.
Common Pitfalls:
Confusing .bashrc
(non-login interactive) with .profile
; forgetting that display managers or modern shells may load different files depending on login type; mixing csh (.login
) conventions with Bourne shell behavior.
Final Answer:
.profile
Discussion & Comments