有以下命令可以查看 centos 版本号:
rpm -q centos-release
lsb_release -a
[root@client usr]# 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.10 (Final)
Release: 6.10
Codename: Final
这个命令适用于所有的linux,包括Redhat、SuSE、Debian、Centos等发行版。
[root@client usr]# uname
Linux
You have new mail in /var/spool/mail/root
[root@client usr]# uname -r
2.6.32-754.6.3.el6.x86_64
[root@client usr]# uname -a
Linux client 2.6.32-754.6.3.el6.x86_64 #1 SMP Tue Oct 9 17:27:49 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
以下二种方法适用于RedHat,CentOS
[root@client usr]# cat /etc/redhat-release
CentOS release 6.10 (Final)
登录到linux执行 rpm -q redhat-release , centos 执行 rpm -q centos-release
当前centos 版本与redhat对应的版本的命令
cat /proc/version
[root@client usr]# cat /proc/version
Linux version 2.6.32-754.6.3.el6.x86_64 (mockbuild@) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) ) #1 SMP Tue Oct 9 17:27:49 UTC 2018