CompTIA Linux+ Powered by LPI (LX0-103) — Question 14
Which of the following commands will print the last 10 lines of a text file to the standard output?
Answer options
- A. cat -n 10 filename
- B. dump -n 10 filename
- C. head -n 10 filename
- D. tail -n 10 filename
Correct answer: D
Explanation
The correct command is 'tail -n 10 filename', which specifically retrieves the last 10 lines of a file. The 'cat' command with '-n' lists all lines with line numbers, 'dump' is not a standard command for this purpose, and 'head -n 10 filename' shows the first 10 lines instead of the last.