Difficulty: Easy
Correct Answer: head
Explanation:
Introduction / Context:
When inspecting large files, it is often unnecessary to print the entire content. The Unix toolset includes commands optimized for viewing just the beginning of a file, which improves performance and readability in diagnostics, log analysis, and scripting tasks.
Given Data / Assumptions:
Concept / Approach:
The head command prints the first lines of a file to standard output (default: 10 lines). It supports options like -n to specify line counts (e.g., head -n 50 file.log) or -c to print bytes. This is more efficient than cat when only a preview is needed and clearer than pagers for a quick glance.
Step-by-Step Solution:
Verification / Alternative check:
Compare with tail (end of file) to ensure you are targeting the correct portion. Use wc -l file to understand file length if context matters.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
head.
Discussion & Comments