Difficulty: Easy
Correct Answer: find / -name '.profile' -print
Explanation:
Introduction / Context:
User shell initialization files such as .profile influence environment variables, PATH, and login behavior. Administrators often need to audit or update all .profile files on a system. The find utility provides a recursive, flexible way to search the entire filesystem or a subtree by filename.
Given Data / Assumptions:
Concept / Approach:
The command find / -name '.profile' -print recursively descends from the root directory, matching files whose basename equals .profile and printing their paths. Quoting the name prevents shell globbing and correctly preserves the leading dot. -print is explicit for clarity on classic UNIX find implementations.
Step-by-Step Solution:
Verification / Alternative check:
Manually navigate to a reported path and run ls -la to confirm the file exists and is a regular file. For a smaller search, use find ~ -name '.profile' -print to search only the current user's home.
Why Other Options Are Wrong:
b: ls profile looks in the current directory and for profile (without dot), not recursively.
c: cd /.profile attempts to change into a file; also wrong path.
d: l -u .profile is not a standard command.
e: Searches only the current user's home, not the entire system as required.
Common Pitfalls:
Forgetting the leading dot; failing to quote the pattern; running from a restricted account that cannot traverse certain directories.
Final Answer:
find / -name '.profile' -print
Discussion & Comments