If you are running a centos server for example then you might need to check the version number and kernel version. This is important to know if you are running the latest version or not and what updates are available for your version.
This is an absolutely basic task for a sys admin to find out the version of the linux distro installed on a system or server.
Check CentOS version
To find your centos version use any or all of the following commands
# cat /etc/redhat-release CentOS release 6.4 (Final)
# cat /etc/centos-release CentOS release 6.4 (Final)
Or output all of the files suffixed with '-release'.
# cat /etc/*-release CentOS release 6.4 (Final) CentOS release 6.4 (Final) CentOS release 6.4 (Final)
Another file that contains the centos version information is /etc/issue and /etc/issue.net
# cat /etc/issue CentOS release 6.4 (Final) Kernel \r on an \m
# cat /etc/issue.net CentOS release 6.4 (Final) Kernel \r on an \m
Or output both of them together
# cat /etc/issue* CentOS release 6.4 (Final) Kernel \r on an \m CentOS release 6.4 (Final) Kernel \r on an \m
The rpm command can also be used to query for the centos version information.
# rpm -q centos-release centos-release-6-4.el6.centos.10.x86_64
Check the kernel version
Along with the centos version information it is also useful to know what version of the kernel is running. Keeping the kernel uptodate is necessary to get bug fixes and security fixes.
The kernel version can be easily checked with the uname command
# uname -r 2.6.32-358.11.1.el6.x86_64
The kernel version in the above output is 2.6.32
The architecture is 64bit.
To display only the machine architecture information with uname use the '-m' option.
# uname -m x86_64
The architecture information can also be checked using the arch command
# arch x86_64
For more information check the /proc/version content.
# cat /proc/version Linux version 2.6.32-358.11.1.el6.x86_64 ([email protected]s.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Wed Jun 12 03:34:52 UTC 2013
Those were a bunch of commands to check the version of your centos linux.
The lsb_release command is not available on centos by default. It can be installed by installing the redhat lsb packages from the base repository.
# yum install redhat-lsb
# yum install redhat-lsb-core
Now you can use the lsb_release command to check the version information of your centOS system
# lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.4 (Final) Release: 6.4 Codename: Final
Cool! It always feels great to have complete information about the system.