The tail command which is found on almost all Linux distributions is used to output the last part of files. There is a parameter for the tail command that allows you to monitor a file, and continually output new lines from the file as they are added. This is especially handy for monitoring log files that are constantly being updated. The commands below can be used to continuously monitor log files.
Monitor a log file using tail:
$ tail -f /var/log/messages
Monitor a log file and cut the output at the console width so it doesn’t wrap:
This is handy for logs that are often long, and makes it hard to read on the screen. For example, Apache or Nginx log files.
$ tail -f /var/log/apache2/access.log | cut -b-$COLUMNS
Monitor multiple files at once:
$ tail -qf /var/log/apache2/*.log
This is handy for monitoring the access.log file and the error.log file at the same time.