Difficulty: Easy
Correct Answer: .profile
Explanation:
Introduction / Context:
On UNIX and Linux, each user can customize the shell environment at login. The shell reads specific dotfiles in the user’s home directory to set variables, change the PATH, define aliases, and start background agents. Knowing which file is executed at login is essential for persistent configuration and troubleshooting environment issues.
Given Data / Assumptions:
Concept / Approach:
For Bourne/POSIX shells, the standard login initialization file is ~/.profile. When a login shell starts, it sources this file and applies exported variables, PATH changes, and other startup logic. Other shells have different files (e.g., bash also uses ~/.bash_profile or ~/.bash_login; csh/tcsh use ~/.login and ~/.cshrc), but .profile is the classic answer for Bourne-style shells.
Step-by-Step Solution:
Verification / Alternative check:
Check your shell’s manual (man sh, man bash) for the exact startup file order. On bash, ~/.bash_profile may be preferred; if absent, bash will fall back to ~/.profile for login shells.
Why Other Options Are Wrong:
.exrc: vi editor configuration, not a shell login file. .autoexec / autoexec.bat: DOS/Windows legacy startup files, not UNIX. None of the above: incorrect because ~/.profile is valid.
Common Pitfalls:
Editing the wrong file for the shell in use; forgetting to export variables; expecting changes to apply to already running shells without sourcing the file.
Final Answer:
.profile
Discussion & Comments