LFCA · Question #32
How do you display the first 10 lines of a file in Linux?
The correct answer is D. head. The head command in Linux is used to display the first 10 lines of a file by default.
Question
How do you display the first 10 lines of a file in Linux?
Options
- Atail
- Bless
- Ccat
- Dhead
How the community answered
(30 responses)- A7% (2)
- B3% (1)
- D90% (27)
Why each option
The `head` command in Linux is used to display the first 10 lines of a file by default.
The `tail` command displays the last 10 lines of a file by default.
The `less` command is a pager that allows viewing file content interactively, but does not specifically display only the first 10 lines by default.
The `cat` command concatenates files and prints their entire content to standard output.
The `head` command displays the first few lines of a file or files to standard output, with the default number of lines being 10. You can specify a different number using the `-n` option.
Concept tested: Linux file viewing commands (head)
Source: https://man7.org/linux/man-pages/man1/head.1.html
Topics
Community Discussion
No community discussion yet for this question.