All Linux systems create and store information about servers, boot processes, kernel, and applications in log files, which can be helpful for troubleshooting as it contains systems activity logs. The log files are stored in /var/log directory and its subdirectory. In this tutorial, we will learn how to view and monitor log files in CentOS8 using different ways. So, let’s get started.

View log files using tail command

It is the most commonly used command to view logs. To use this command –f is used to follow the content of the file, open up the terminal and type the following command:

# sudo tail –f /var/log/apache2/access.log

As log files are changed apparently. If you want to display a limited number of lines use –n and the number of lines you want to display, as shown below.

# sudo tail –n5 –f /var/log/apache2/access.log

This command will only display the last five lines of the log file, as shown below.

Less command

To view the live output of the file using –F with less command as shown below.

# sudo less –f /var/log/httpd/access_log

Using Multitail command – view multiple log files

If you want to display multiple log files simultaneously use the multitail command. The name itself implies that it is used to view and monitor multiple log files. For this we need to install the package firstly. Use the following command to install the package in CentOS8.

# sudo dnf install –y multitail

After the installation is completed, it’s a time to display two log files simultaneously. For this use the use the following command.

# sudo multitail /var/log/httpd/access_log /var/log/httpd/error_log


In this tutorial, we learned how to view the log files using different ways, we also saw how to view multiple log files simultaneously using multitail command, how to display the limited number of lines.

How to view and monitor log files in CentOS 8

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.