From the course: Learning Linux Command Line

Find information about your Linux distribution - Linux Tutorial

From the course: Learning Linux Command Line

Find information about your Linux distribution

- [Instructor] Until now, almost everything we've done has been distribution independent. That is, it hasn't mattered if we're running CentOS, Fedora, Ubuntu, or another distribution of Linux. But it's good to know what environment we're working with in case we need to make some changes to the system or install software. Or if we need that information in order to ask for help. If we find ourselves in an environment we don't know about, such as a system set up for us by someone else, the first thing we need to do is understand which Linux distribution we're using. One place this information can be found is in files inside the ETC folder. What the files are called specifically can vary based on which Linux distribution you're using. But we can use a wildcard to match the name of these files and see what's inside them. First, let's look at what these files are. I'll write ls dash l slash etc slash asterisk release. And in my case, I have two files here. LSB release and OS release, which is a link to another file in usr/lib. Let's see what information is in these files. First, I'll type cat etc lsb dash release. Here, I can see that I'm running Ubuntu 20.04, which is code named "focal," short for Focal Fossa. Let's look at the other file with cat etc os release. Here's a little bit more information, but generally it's the same. To look at these at the same time, we could write cat etc asterisk release. Here I can see the contents of the first file, and the second file. On other systems, we'll see slightly different information here. This, for example, is the output of those commands on the Fedora 34 workstation system. And here's the output from Alpine Linux. Another important piece of information to know about a system is what version of the Linux kernel we're using. This can determine what features are available to us. We can find that information with the uname command and I'll use the dash a option to show all information. This shows the type of system, in this case Linux, the host name of the system, the version of the kernel, the architecture of the system, and so on. To just retrieve the version of the kernel, we can use uname dash r. This kind of information can be very helpful if you're troubleshooting something and need to ask for help. And it can inform whether certain software runs and what tools you have available. Again, if we've set up a system ourselves, chances are high that we know what kind of distribution and hardware it's running. But, if for some reason we don't, now we've seen how to figure it out.

Contents