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 行的內容。為正確答案。