Live as if you were to die tomorrow. Learn as if you were to live forever.

Tuesday 6 January 2015

How to check Linux Distribution, Architecture and Kernel ?

How to check the Linux Distribution ?

To check which Linux Distribution we can see the file /etc/issue or /etc/redhat-release

[root@localhost ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.0 (Santiago)
Kernel \r on an \m

[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.0 (Santiago)
[root@localhost ~]#

Here, we can say that we are using the RedHat Linux 6

Find out the system architecture ?

Use the below commands to find out the system architecture.
  
[root@localhost ~]# arch
x86_64

[root@localhost ~]# uname -m
x86_64

[root@localhost ~]# getconf LONG_BIT
64

Here, x86_64 means the system is 64-bit. If you will get i386 or i686 then the system is 32-bit. If you are confused in x86_64 and i386 simply type the command  "getconf LONG_BIT", You will come to know the archiecture.

Check the Linux Kernel

To check the linux kernel use the below command

[root@localhost ~]# uname
Linux

[root@localhost ~]# uname -s
Linux

It only print the name of  the kernel. Here, linux is the name of kernel.

Check the kernel version

There are various commands in linux to check the kernel version. You can use any one of the below command to check the kernel version.

[root@localhost ~]# uname -r
2.6.32-71.el6.x86_64

[root@localhost ~]# cat /proc/version
Linux version 2.6.32-71.el6.x86_64 (mockbuild@x86-007.build.bos.redhat.com) (gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) ) #1 SMP Wed Sep 1 01:33:01 EDT 2010
[root@localhost ~]# 

[root@localhost ~]# rpm -q kernel
kernel-2.6.32-71.el6.x86_64

[root@localhost ~]# dmesg | grep Manufacturer | grep Linux
usb usb1: Manufacturer: Linux 2.6.32-71.el6.x86_64 ehci_hcd
usb usb2: Manufacturer: Linux 2.6.32-71.el6.x86_64 uhci_hcd


Here, 2.6.32-71.el6.x86_64 is the kernel version. 
2   ------>  Kernel version
6   ------>  Major release
32 ------> Minor release
71.el6 --> Fix  
x86_64 -> Architecturex86_64 means the system is 64-bit


Note: Interview point of view all above information is very important. :)

2 comments: