nerdexam
Linux_Foundation

LFCS · Question #854

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

The correct answer is D. tail -n 10 filename. The tail command is used to display the last lines of a file, and the -n option specifies the exact number of lines to output.

Submitted by haru.x· Apr 18, 2026Essential Commands

Question

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

Options

  • Acat -n 10 filename
  • Bdump -n 10 filename
  • Chead -n 10 filename
  • Dtail -n 10 filename

How the community answered

(58 responses)
  • A
    3% (2)
  • B
    5% (3)
  • C
    2% (1)
  • D
    90% (52)

Why each option

The `tail` command is used to display the last lines of a file, and the `-n` option specifies the exact number of lines to output.

Acat -n 10 filename

The `cat` command concatenates and prints file content, and its `-n` option numbers all output lines, it does not limit the output to the last 10 lines.

Bdump -n 10 filename

The `dump` command is primarily used for filesystem backups, not for displaying specific portions of text files.

Chead -n 10 filename

The `head` command outputs the *first* part of files, so `head -n 10 filename` would print the first 10 lines, not the last 10.

Dtail -n 10 filenameCorrect

The `tail` command is specifically designed to output the trailing parts of files, and the `-n 10` option explicitly instructs it to print only the last 10 lines to standard output, fulfilling the requirement.

Concept tested: Linux tail command usage

Source: https://man7.org/linux/man-pages/man1/tail.1.html

Topics

#tail command#file viewing#command line utilities#standard output

Community Discussion

No community discussion yet for this question.

Full LFCS Practice