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

A.

cat -n 10 filename

B.

dump -n 10 filename

C.

head -n 10 filename

D.

tail -n 10 filename

题解

「cat」可以显示文件的内容。「dump」用来备份文件系统。「head」用来显示文件前面的内容。「tail」用来显示文件后面的内容。

选项 A,显示所有文件的内容并加上行号。

选项 B,「dump」指令不能这样用。

选项 C,显示文件前面 10 行的内容。

选项 D,显示文件最后 10 行的内容。为正确答案。