How to view Linux server logs

Something is wrong with your dedicated server, but that is not even the bad news. The bad news is that you don’t even know it yet. Everything appears to be fine, and it will continue to, as long as you are not monitoring it. Hidden deep within the layers of code, commands, and directories is a ticking time bomb. So, what can you do? One step you can take is to monitor your server’s logs.

Most Linux system logs are kept in the /var/log directory. To access them, follow these steps:

1. You will first need to log in to your server via SSH. For Windows, you can use PuTTY. For Linux or Mac OS X, simply open a terminal and type:

ssh -l username

2. When it prompts you for your password, type it and press Enter.

3. Go to the log directory:

cd /var/log

4. To list the contents of the directory, type:


5. There are three methods you can use to view the logs. For example, if you want to view the kernel messages log, type one of the following:

tail -f /var/log/messages
This will show you the last few lines of the log (i.e. only the latest information).

less /var/log/messages
The “less” command gives you a scrollable view of the log, controlled with the arrow keys.

more -f /var/log/messages
Use “more” to get a paged view. Pressing enter or the space bar will show more of the text, which is all loaded at once.

Logs for applications are often kept in directories. For example, the Apache HTTP Server log is often inside the httpd or apache2 directory. Once inside, you will see an access log and an error log, along with log archives. You can then view them using the same above-mentioned methods. Now, you can rest a little easier, knowing your server stability is real, rather than the calm before the storm.