nerdexam
Linux_Foundation

LFCA · Question #27

What command is used to view new content as it is written to a log file?

The correct answer is D. tail -f. The tail -f command is used to output the last part of files and then continuously monitor the file, appending new data as it is written to the file. This makes it ideal for real-time viewing of log files.

Submitted by femi9· May 4, 2026System Administration

Question

What command is used to view new content as it is written to a log file?

Options

  • Acat
  • Bgrep -f
  • Ccut -f1-5
  • Dtail -f

How the community answered

(48 responses)
  • A
    4% (2)
  • B
    2% (1)
  • C
    2% (1)
  • D
    92% (44)

Why each option

The `tail -f` command is used to output the last part of files and then continuously monitor the file, appending new data as it is written to the file. This makes it ideal for real-time viewing of log files.

Acat

The `cat` command concatenates and displays the entire content of a file to standard output at once; it does not continuously monitor for new content.

Bgrep -f

The `grep -f` command reads patterns from a file and searches for them in other files; it is used for pattern matching, not for continuously displaying new log file content.

Ccut -f1-5

The `cut` command is used to extract sections from each line of files, typically by bytes, characters, or fields; it is not designed for continuous monitoring of new file content.

Dtail -fCorrect

The `tail -f` command displays the last portion of a file and then 'follows' it, continuously outputting new data as it is appended to the file. This is crucial for real-time monitoring of log files to observe events as they occur.

Concept tested: Linux log file monitoring

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

Topics

#Log file monitoring#Command-line tools#File utilities#tail command

Community Discussion

No community discussion yet for this question.

Full LFCA Practice