How to display the last lines?

0123

To display the last lines of a file, you can use the tail command. Here’s how you can do it:

  1. Display the last 10 lines (default):

    tail filename.txt
  2. Display a specific number of last lines:
    Use the -n option followed by the number of lines you want to see. For example, to display the last 5 lines:

    tail -n 5 filename.txt
  3. Display the last N bytes instead of lines:
    You can use the -c option to view the last N bytes. For example, to view the last 20 bytes:

    tail -c 20 filename.txt

These commands will help you view the end of a file as needed.

0 Comments

no data
Be the first to share your comment!