CentOS 7查看系統版本和機器位數

1.1. 查看系統版本

方法1:用lsb_release -a命令

[root@bogon ~]# lsb_release -a

LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch

Distributor ID: CentOS

Description:    CentOS Linux release 7.4.1708 (Core)

Release:        7.4.1708

Codename:       Core

這個命令可以看到準確的系統版本

 

如果出現下面提示,說明沒有安裝lsb_release命令

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

安裝lsb_release命令:

yum install -y redhat-lsb

方法2cat /etc/os-release命令

[root@bogon ~]# cat /etc/os-release

NAME="CentOS Linux"

VERSION="7 (Core)"

ID="centos"

ID_LIKE="rhel fedora"

VERSION_ID="7"

PRETTY_NAME="CentOS Linux 7 (Core)"

ANSI_COLOR="0;31"

CPE_NAME="cpe:/o:centos:centos:7"

HOME_URL="https://www.centos.org/"

BUG_REPORT_URL="https://bugs.centos.org/"

 

CENTOS_MANTISBT_PROJECT="CentOS-7"

CENTOS_MANTISBT_PROJECT_VERSION="7"

REDHAT_SUPPORT_PRODUCT="centos"

REDHAT_SUPPORT_PRODUCT_VERSION="7"

 這個命令看不到具體的版本信息,但是可以看到除詳細版本信息之外的其他信息


方法3cat /etc/redhat-release命令

[root@bogon ~]# cat /etc/redhat-release

CentOS Linux release 7.4.1708 (Core)

 這個命令效果同lsb_release -a,不過這個命令只顯示系統版本

 

1.2. 查看內核版本

方法1:用cat /proc/version命令

[root@bogon ~]# cat /proc/version

Linux version 3.10.0-693.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Aug 22 21:09:27 UTC 2017

 方法2:用uname -a命令

[root@bogon ~]# uname -a

Linux bogon 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

 

1.3. 查看位數

這個就一種方式,最好判斷,用getconf LONG_BIT

32位的系統中int類型和long類型一般都是4字節,64位的系統中int類型還是4字節的,但是long已變成了8字節inux系統中可用"getconf WORD_BIT""getconf LONG_BIT"獲得wordlong的位數。64位系統中應該分別得到3264

也就說32位使用這兩個命令得到的都是32,64位得到的3264

[root@bogon ~]# getconf WORD_BIT

32

[root@bogon ~]# getconf LONG_BIT

64

 

擴展請看https://blog.csdn.net/u011630575/article/details/51426429

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章