How to display last N lines?

QuestionsQuestions8 SkillsProDec, 12 2025
0101

Hi there!

You've asked a great question! While head shows the beginning of a file, to display the last N lines of a file, you would use the tail command.

The tail command works very similarly to head. For example:

tail -n5 /tmp/some_file

This command would display the last 5 lines of the file /tmp/some_file. Just like with head, you can replace the 5 with any number to specify how many lines you want to see from the end of the file.

Would you like to try it out with a file in your current lab environment?

0 Comments

no data
Be the first to share your comment!