Exam LFCS All QuestionsBrowse all questions from this exam
Question 77

Which of the following commands will print the last 10 lines of a text file to the standard output?

    Correct Answer: D

    The command 'tail -n 10 filename' will print the last 10 lines of a text file to the standard output. The 'tail' command is designed to display the last part of a file, and the '-n 10' option specifies that the last 10 lines should be printed.

Discussion
9866666Option: D

The correct answer is D. tail -n 10 filename Explanation: tail is a command specifically designed to display the last part of a file. The -n 10 option instructs it to print the last 10 lines. cat is used to concatenate and print the entire contents of files. The -n option adds line numbers, but it won't limit the output to the last 10 lines. dump is not a standard Linux command for working with files. head is used to display the first part of a file. The -n 10 option would print the first 10 lines.