CentOS 版本信息

第一种方式

显示正在运行的内核版本

cat /proc/version

输出

Linux version 3.10.0-1127.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Mar 31 23:36:51 UTC 2020

第二种方式

显示电脑以及操作系统的相关信息

uname -a

输出

Linux localhost.localdomain 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

第三种方式

显示操作系统的发行版本号

uname -r

输出

3.10.0-1127.el7.x86_64

Linux 版本信息

第一种方式

查看 Linux 发行版本。LSB 是 Linux Standard Base 的缩写,lsb_release 命令用来显示 LSB 和特定版本的相关信息。

lsb_release -a

输出

LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.8.2003 (Core)
Release:	7.8.2003
Codename:	Core

运行该命令时若提示 lsb_release 命令不存在 不存在,则表明系统未安装该命令,报错如下:

报错

bash: lsb_release: 未找到命令...

查找软件包

yum provides */lsb_release
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
extras/7/x86_64/filelists_db                                                        | 277 kB  00:00:01     
redhat-lsb-core-4.1-27.el7.centos.1.i686 : LSB Core module support
源    :base
匹配来源:
文件名    :/usr/bin/lsb_release

redhat-lsb-core-4.1-27.el7.centos.1.x86_64 : LSB Core module support
源    :base
匹配来源:
文件名    :/usr/bin/lsb_release

安装

sudo -y install redhat-lsb-core-4.1-27.el7.centos.1.x86_64

安装成功

已安装:
  redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1                                       
作为依赖被安装:
  redhat-lsb-submod-security.x86_64 0:4.1-27.el7.centos.1            spax.x86_64 0:1.5.2-13.el7           

第二种方式

cat /etc/redhat-release

输出

CentOS Linux release 7.8.2003 (Core)

系统位数

第一种方式

getconf LONG_BIT

输出

64

第二种方式

file /bin/ls

输出

/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=aaf05615b6c91d3cbb076af81aeff531c5d7dfd9, stripped

第三种方式

lsb_release  -a
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐