Linux distribution info

Linux distribution info & kernel info

|

Do you have multiple vms and real machines you use for random testing, and small tasks? need to know what machine you are on? what kernel you are using? what the current Linux distribution info is? what OS version did you last install on here? and more such questions? well! we have some of the answers for you. well maybe not answers, but more like small tools so you can get the answers!

Distribution info

lsb_release -a
on my ubuntu system it gives the following result :

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Xenial Xerus (development branch)
Release: 16.04
Codename: xenial

On a debian system it gives the following result :

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.4 (jessie)
Release: 8.4
Codename: jessie

If lsb_release -a doesn’t cut it for you then you can try
cat /etc/issue

as a result we see the following examples :

# cat /etc/issue
Debian GNU/Linux 8 \n \l

$ cat /etc/issue
Ubuntu Xenial Xerus (development branch) \n \l

In some cases where you suspect you are on centos or redhat, maybe because you noticed the package versions are old enough to be used by columbus while sailing the open seas, then you can use either

cat /etc/centos-release

or

cat /etc/redhat-release

which will give you result such as :

CentOS release 6.2 (Final)

Kernel Info

now as far as finding the kernel info goes you can get all the info you need via uname.

$ uname -a
Linux testhost 4.4.0-9-generic #24-Ubuntu SMP Mon Feb 29 19:33:19 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ uname -r
4.4.0-9-generic

as you can see uname -r gives you just the kernel version and uname -a gives you multiple pieces of info, like date the kernel was compiled, the arch (i.e. x86_64).

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *