How to display last lines?

086

To display the last lines of a file, you can use the tail command in Unix-like operating systems. Here’s how to do it:

Syntax

tail -n [NUMBER] filename.txt

Example

If you want to display the last 10 lines of a file named example.txt, you would use:

tail -n 10 example.txt

Additional Options

  • Display the last N bytes: You can use the -c option to display the last N bytes of a file. For example:

    tail -c 20 example.txt
  • Follow the output: If you want to continuously monitor a file for new lines (useful for log files), you can use the -f option:

    tail -f example.txt

Conclusion

The tail command is a powerful tool for viewing the end of files. If you have any more questions or need further assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!