Sobes.tech
Junior

How to output only the last 100 lines from logs?

sobes.tech AI

Answer from AI

Use the tail command with the -n option.

tail -n 100 /path/to/your/log/file.log

If the file is updated in real-time and you want to monitor the latest lines, use the -f option:

tail -f -n 100 /path/to/your/log/file.log