Linux Foundation Certified System Administrator (LFCS) — Question 121
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 command 'tail -n 10 filename' is specifically designed to show the last 10 lines of a file, making it the correct choice. In contrast, 'cat' and 'dump' do not provide the desired output of the last lines, and 'head' retrieves the first lines of the file instead.