View Some Logs In The Terminal

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 CTRL + ALT + T. If that doesn’t work, you’ll almost certainly find a terminal in your application menu.

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:

If you want to view the previous session’s kernel logs, use this command:

Both of those commands will flood your terminal. That’s okay, you can use the pipe operator and the less command like so:

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:

If you want to check the previous boot log, check it with this command:

Again, you can use a pipe and the less command to manage the flow of data.

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:

If you want to check the previous system log, run this command:

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.

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.

Show Installed Kernels In Ubuntu

Today’s article should be fairly short and straight to the point, as we discuss how to show installed kernels in Ubuntu. This isn’t a very complicated thing and we’ll be showing these kernels in the terminal. Sure, there are GUI tools you can use, but you might as well learn to do this in the terminal.

A lot of people ask the question, “What is Linux?”

Well, Linux is just the kernel. The kernel schedules tasks, interfaces with hardware, and generally manages the stuff that goes on at a lower level. This is surrounded by GNU’s tools and you will generally add a window manager and desktop environment on top to turn it into a useable desktop system with a fancy GUI.

You might enjoy reading this article:

The “Linux” or “GNU/Linux” Debate

Under all that is the kernel. It’s very important! Without it, we’d have no Linux. There are other kernels out there, but the topic of this site is Linux Tips. But, without a kernel, your computer would be dead in the water. 

In the course of updating your system, and depending on how you do your updates, you’ll install new kernels as they are released. GRUB will default to the newest kernel in most configurations, but there are other kernels installed and those can be selected from an advanced menu during the boot process.

Unless you have a brand new install that hasn’t been updated recently (kernel updates are common), you’ll have more than one kernel installed. Even if you upgrade Ubuntu in the terminal, even if you use ‘autoremove‘, Ubuntu will store the previous kernel. This is a good thing, as you can boot to that kernel if the new one should give you trouble.

It’s sometimes necessary to wait out a kernel version because it doesn’t run properly on your system. That’s not common, but it does happen. When that does happen, you should update manually and control what software is removed so that you don’t remove the working kernel and can still have a usable system. It happens, it’s just not all that common.

By the way, the kernel is mostly worked on by paid developers these days. The current kernel has more than thirty million lines of code. Of course, it contains drivers for hardware new and old and those folks using the older equipment will scream bloody murder if you remove their drivers from the kernel. Still, stuff gets culled regularly – it’s for the good of the herd! Maintaining all that for three users is asking too much.

What have we learned?

We’ve learned that the kernel is important and kind of what it does. We’ve also learned that you have more than one kernel installed. Additionally, we’ve learned why that’s a good thing. So, we’re doing okay so far!

Show Installed Kernels In Ubuntu:

As the first paragraph said, you’re going to need an open terminal. This is true for most of my articles. You should know how to open a terminal by now. If not, press CTRL + ALT + T and hope for the best! That keyboard shortcut is not quite universal, but fairly close.

These instructions are going to work in Debian, Ubuntu, Mint, etc… At least one of them may work for other distros. I can’t say that I’ve tried recently and I’m not going to make any claims. Where we use ‘dpkg‘, that’s going to be exclusive to those distros with dpkg – the Debian Package Manager.

Seeing as I mentioned dpgk, we can start with that command first. If you want to show installed kernels in Ubuntu using dpkg, the command is simply:

That might look something like this:

showing the installed kernels in Ubuntu
See? There are multiple kernels installed at this point on this particular system.

If you search the ‘net, you’ll find there are all sorts of ways to do this – including some fancy commands that use egrep and show colors. I don’t see any reason to include those. What we have here works.

If you want, you can also use the find command. That’s a nice and handy command and I suppose this command might work on other distros. To show installed kernels in Ubuntu using the find command, try this command:

That should list your installed kernels quickly and without any fuss (and no muss). There are all sorts of ways to find this information but we’ve just covered the two quickest and easiest ways I can think of (in the terminal). It’s probably quicker in the terminal than it is for any other method, especially if you’ve always got an open terminal (or three).

Closure:

Well, there you have it… You have learned how to show installed kernels in Ubuntu, a useful skill to have (especially if you’re having kernel issues). These are easy enough to remember commands, or you can always use this site’s search function to find what you need. I do that myself. I’m always referring to articles I’ve written and the search function isn’t great but it does work.

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.

How To: Find Out Which Kernel Version You’re Using

The Linux kernel‘s progress is marked by versioning, and this article tells you how to find out which kernel version you’re using. There are all sorts of ways to do this, but this article is going to just cover a few of them.

You might want to know which kernel version you’re using for when you ask for support. It may be that your hardware is best (or only) supported after or before a certain kernel. It may be that you want to know which kernel you’re using because you want to upgrade or downgrade the kernel.

For example, I recently didn’t want to switch to the new kernel. I saw that there was a kernel update, learned which kernel version I was now using, and promptly decided to return to an older LTS kernel. Yes, different kernel versions will have different support lengths. I opted for a more stable and consistent kernel as none of my hardware required a newer kernel.

There are any number of reasons why you’d want to know which kernel version you’re using. And, as stated, there are any number of ways to get that information. This article only covers some of them.

Find Out Which Kernel Version You’re Using:

This article will only show you how to determine which kernel version you’re using with the terminal. Of course, this means you need an open terminal. You can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, you can try:

The information is also contained in the output of ‘hostnamectl’, so working with grep you’d have this command:

You can also use cat on/proc/version in a command that looks like:

If you have screenfetch or neofetch installed, the output contains the kernel version that you’re using. An output from those would look kinda like this:

neofetch in action
Neofetch in action, showing the kernel version number. See? It’s all over the place!

So, there are any number of ways to find which kernel version you’re using. There are surely other ways to find the kernel version, so feel free to leave a comment letting us know how you find your kernel version.

By the way, if you’re having problem with your current kernel, your distro probably has at least the previous kernel installed and you can use that as a fallback. Even if it automatically deletes old kernels, it usually leaves at least one older kernel as a way to recover should the proverbial poop hit the aerator.

Closure:

See? That wasn’t so painful! It’s another article that’s said and done. We’re getting closer to the halfway point, but I’m legitimately having fun getting my notes online. I admit, I pretty gleefully monitor the increasing (or sometimes consistent) traffic. It makes me happy to know my notes are helping.

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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.