tail
Show the last lines of a file, or follow it
What it does
tail prints the end of a file, 10 lines by default; -n sets the number. The newest log entries are right there at the end.
With -f (follow) it keeps running and prints new lines as they are written to the file. That is how you watch server logs live. Quit with Ctrl+C.
Syntax
tail <file>
tail -n <number> <file>
tail -f <file>Examples
Follow the app.log log in real time
tail -f app.logsame as:
tail --follow app.logtail— end of the file-f— show new lines as they are writtenapp.log— file