How does the head command differ from the tail command?

The head command and the tail command serve opposite purposes:

  • head: Displays the beginning of a file. By default, it shows the first 10 lines, but you can customize the number of lines using the -n option.

  • tail: Displays the end of a file. By default, it shows the last 10 lines, and you can also customize the number of lines with the -n option. Additionally, tail has a -f option that allows you to monitor a file in real-time, displaying new lines as they are added.

In summary, head is for viewing the start of a file, while tail is for viewing the end.

0 Comments

no data
Be the first to share your comment!