1. 程式人生 > >centos、linux檢視系統資訊

centos、linux檢視系統資訊

檢視位數命令

命令實在是不要太多,為了防止選擇性障礙,一致選擇第一種方式,後面的僅作為補充。
方法1:

[[email protected] ~]# uname -a
Linux bogon 3.10.0-327.18.2.el7.x86_64 #1 SMP Thu May 12 11:03:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

方法2:顯示系統程式資訊

[[email protected] ~]# 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]=aa7ff68f13de25936a098016243ce57c3c982e06, stripped

方法3:

[[email protected] ~]# cat /proc/version
Linux version 3.10.0-327.18.2.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu May 12 11:03:55 UTC 2016

方法4:

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

[[email protected] ~]# getconf LONG_BIT
64

檢視系統版本

方法1:

[[email protected] ~]#  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.2.1511 (Core) 
Release:    7.2.1511
Codename:   Core

方法2:


[[email protected] ~]# 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"

方法3:

[[email protected] ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 

方法4:

[[email protected] ~]# rpm -q centos-release
centos-release-7-2.1511.el7.centos.2.10.x86_64

檢視核心版本

方法1:

[[email protected] ~]# cat /proc/version
Linux version 3.10.0-327.18.2.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu May 12 11:03:55 UTC 2016

方法2:

[[email protected] ~]# uname -a
Linux bogon 3.10.0-327.18.2.el7.x86_64 #1 SMP Thu May 12 11:03:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux