当我们拿到一个 Linux 服务器的时候,我怎么知道他是 centos 系统,还是 ubantu 系统呢?
如果知道是 centos系统了,那我怎么知道他是 centos7.6还是 centos8.0 还是其它的版本?

lsb_release 查看系统

先使用 yum 安装 redhat-lsb

yum install -y redhat-lsb

安装完成后,使用 -a 查看

[root@yoyo ~]# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.6.1810 (Core) 
Release:	7.6.1810
Codename:	Core

于是就可以知道是 centos 7.6版本

redhat-release

如果已经知道是 centos 系统了,可以直接 cat 查看版本号

[root@yoyo ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core) 

uname 查看内核版本

查看内核版本可以用uname -a

[root@yoyo ~]# uname -a
Linux iZ2vchn8sk983jm605yhshZ 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

也可以cat /proc/version

[root@iZ2vchn8sk983jm605yhshZ ~]# cat /proc/version
Linux version 3.10.0-957.21.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) 
(gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Tue Jun 18 16:35:19 UTC 2019

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-11-10
  • 2021-12-26
猜你喜欢
  • 2021-12-03
  • 2021-09-07
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案