How To View Log File In Linux

Log files play a vital role in troubleshooting. Knowing where they’re stored and how to read them is pertinent information. I came from a Windows background. Microsoft made it pretty easy. Linux uses a different set of rules.

Login as root user using SSH

Navigate to /var/logs directory
# cd /var/logs

To list files use the following command
# ls

To view a common log file called /var/log/messages use any one of the following command:

# less /var/log/messages
# more -f /var/log/messages
# cat /var/log/messages
# tail -f /var/log/messages
# grep -i error /var/log/messages

You don’t have to use all of those commands. I do recommend trying them all, however, just to see the different types of output available.