Linux Professional Institute Certification Level 1 (LPIC-1) Practice Test

Question: 1 / 400

Which command is used to view the last few lines of a file?

head

tail

The command used to view the last few lines of a file is "tail." It is designed specifically for this purpose, allowing users to see the end of a file's content, which can be especially useful for monitoring log files that are frequently updated. The default behavior of "tail" is to display the last 10 lines, but this can be modified by providing an option to specify a different number of lines.

For example, running `tail -n 20 filename` would show the last 20 lines of the specified file. This feature allows users to quickly assess the most recent entries in a file without having to scroll through the entire document.

In contrast, "head" is used to display the first few lines of a file, while "cat" outputs the entire content of the file to the terminal, which is not suitable for viewing just the last lines. The "more" command is used for paging through the content of a file, but it also does not specifically focus on the last lines.

Get further explanation with Examzify DeepDiveBeta

cat

more

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy