Today we’ll have a relatively simple set of commands that will show you how to view some system logs in the terminal. We’re only going to cover a few of them that are similar in operation. There are far more things that get logged.
You generate logs as you use your computer. These will vary and there are quite a few logs kept. Logs aren’t just kept by the system. Some third-party applications create logs. We’ll only be covering a few system logs. I just want to keep things simple.
The tool we’re using for this exercise is the cat command. The cat application is one tool that lets you read text files in the terminal. It’s a frequently used tool at my house. Hopefully, you too will get comfortable using this command at your house.
It seems like that should be enough of an intro. If you have any questions, you can always leave a comment. Those get seen and addressed more quickly than when you try to contact me elsewhere. (Comments almost instantly send a notification to whatever computer I’m using. They’ll even ping my phone if I turn the notification sound on.)
Anyhow… Ask away, should you have any questions…
View Some System Logs In The Terminal:
We’ll be viewing a few different types of logs. As mentioned above and in the heading, this is something we do in the terminal. You can usually open a terminal by pressing
First, we’ll view the kernel log.
The kernel is the actual “Linux” in your Linux. The kernel deals with task scheduling, and running processes as needed. It’s an abstraction between you and the hardware.
If you want to view the current kernel log, use this command:
1 | cat /var/auth/kern.log |
If you want to view the previous session’s kernel logs, use this command:
1 | cat /var/log/kern.log.1 |
Both of those commands will flood your terminal. That’s okay, you can use the pipe operator and the less command like so:
1 | cat /var/log/kern.log | less |
Next, we’ll view the boot log.
When you boot your computer, the computer keeps track of what happens during that process. This is known as the boot log. It can be exceptionally handy when you have a problem booting.
If you want to check the current boot log, use this command:
1 | cat /var/log/boot.log |
If you want to check the previous boot log, check it with this command:
1 | cat /var/log/boot.log.1 |
Again, you can use a pipe and the less command to manage the flow of data.
1 | cat /var/log/boot.log | less |
Next, we’ll view the system log.
The system logs all sorts of additional information. If you’re not finding the information you want in the previous two logs, checking the system log is prudent. The system logs all sorts of things that are useful for resolving problems.
If you want to check the current system log, use this command:
1 | cat /var/log/syslog |
If you want to check the previous system log, run this command:
1 | cat /var/log/syslog.1 |
Don’t forget that you can use a pipe and less in this command. This will give you a slower output you can manage with your arrow keys.
1 | cat /var/log/syslog | less |
And that will show you your system log.
That’s all it takes to view the major system logs. There are other logs and we’ll have to cover them at some point.
Closure:
Well, this didn’t take too many words or too much time… That’s nice. If you want to start troubleshooting your own problems, learn to read the system logs. If you don’t want to ask for help, learn to read the system logs. Well, that and learn to read the man pages, but that last bit is outside the scope of this article.
I do hope you enjoyed this article. They’re fun to write but it does sometimes feel like work. I never wanted this to feel like it was work, but here we are. It probably would have been wiser to not set such a schedule and to allow some vacation time in there. This whole project started when I had far more time due to the pandemic.
We do have a special day coming up… You’ll see!
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.