Wednesday, April 22, 2009

how to look at the last n lines of a log file?

This comes up everyday. It's very useful to be able to look at the last n lines of some log file. I use tail for this with the -f option like this:

> tail -50f myfile.log

This will tail the last 50 lines of the file. The -f option without a number only looks at the last 10 lines of the file. Adding the extra lines makes it easier to find what you're looking for.

Commands used in this post: tail

No comments: