Friday, February 13, 2015

[Quick Tips]: How to Tell What Distro and Version of Linux You Are Running

How to Tell What Distro and Version of Linux You Are Running


If you’re using Linux as your desktop operating system, you probably are very aware of what version you are running, but what if you need to connect to somebody’s server and do some work? It’s really useful to know exactly what you are dealing with, and luckily it’s also pretty easy.
As with everything in Linux there are multiple ways to get things done, so we’re going to show you a few different tricks and you can pick the one that you like the best.

How to See the Pretty Linux Version

The easiest and simplest way to see the Linux distribution name and the version number is also the one that works on almost every type of Linux. Just open up a terminal and type in the following:
cat /etc/issue
You’ll be presented with output similar to the screenshot at the beginning of this article, which will look something like this:
Ubuntu 14.04.1 LTS
If you need more information you can use a different command, although it may not work on every distro out there, but it definitely works on the major ones. Just like before, open a terminal and type in the following:
cat /etc/*release
This will give you something more like this next screenshot, and you can see that not only do you have the release information, but you also get to see the codename and even the URL. What’s actually happening here is that on Ubuntu there is a /etc/os-release file, but on some other versions there might be something like /etc/redhat-release or another name entirely. By using the * in the command we’re just outputting the contents of any of them to the console.
The easiest method is still the cat /etc/issue command, but this is a nice extra.

How to See the Kernel Version

The version of the distribution you are running is actually a completely different thing than the version of the Linux kernel. You can easily see that version number by opening a terminal and typing in the following:
uname -r
This will give you output like the following, in which we can see that we’re using the 3.15.4 kernel version.

How to Tell Whether You Are Using a 64-bit Kernel

You could probably already tell in the last screenshot that we’re using the 64 bit kernel with the x86_64 text, but the easiest thing to do is use this command from the terminal, which is the same command as before, but with -a for “all” instead of -r for “kernel release.”
uname -a
In this screenshot you can tell that we’re running the x86_64 version of Linux, which means 64-bit. If you were running 32-bit Linux, which you really shouldn’t be doing on a server, it would say “i386″ or “i686″ instead.
The more strict-minded types will probably note that you can use uname -i to show whether you are using 32-bit or 64-bit (useful in a script), but it’s better to just get used to using -a to show you everything at once.

No comments: