Which command would you use to display the last 10 lines of a file?

Prepare for the LPI Linux Essentials 010-160 Test with our comprehensive quiz platform offering flashcards and multiple choice questions. Hints and explanations provided for each question. Get exam-ready with ease!

The command used to display the last 10 lines of a file is the tail command. This command is specifically designed to read the end of a file, and by default, it outputs the last 10 lines. This is particularly useful for quickly checking the most recent entries in log files or any other file where the end content is of interest.

To illustrate, when you run the command tail filename, it will show the last 10 lines of that file. You can customize the number of lines displayed by using the -n option, such as tail -n 20 filename, which would display the last 20 lines instead.

In contrast, other options like head, cat, and last serve different purposes. The head command displays the first lines of a file, the cat command outputs the entire contents of a file, and the last command is used to show the last logged-in users, which is unrelated to file content. Thus, tail is the correct choice for the task of displaying the last 10 lines of a file.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy