The tail command is a very commonly used command to pull the last number of lines from a file.   This is extremely useful when you want to look through error logs to trouble shoot an issue. You can watch a file live or look back as many lines as needed.

Synopsis

tail [OPTION]... [FILE]...

Examples

View the last 10 lines of the error log:
tail error_log

Follow the error log live:
tail -f error_log

Show the last 300 lines of the error log:
tail -300 error_log
or
tail-n300 error_log

 

Common Flags

-f  –  Output the appended data when the file grows

-n  –  Output the last number of lines in the file

-c  –  Output the last K byte of the file

-v  –  Always output headers

Check out all the options available with tail at the full man page