几种查看CentOS版本信息的方法
1. 查看CentOS的kernel版本
查看文件/proc/version
# cat /proc/version
Linux version 3.10.0-229.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Fri Mar 6 11:36:42 UTC 2015
通过uname
命令查看
# uname -r
3.10.0-229.el7.x86_64
uname
命令参数说明
-a, --all print all information, in the following order,
except omit -p and -i if unknown:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type or "unknown"
-i, --hardware-platform print the hardware platform or "unknown"
-o, --operating-system print the operating system
2. 查看CentOS系统版本
查看文件/etc/centos-release
和/etc/redhat-release
" style="border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 1em; letter-spacing: -1px; font-weight: bold;"># cat /etc/centos-releasecat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
CentOS Linux release 7.2.1511 (Core)
# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
查看文件/etc/issue
,注意:在centos7中没有具体信息。
# cat /etc/issue
\S
Kernel \r on an \m
查看文件/etc/redhat-release
# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
LSB是Linux Standard Base的缩写,lsb_release
命令用来显示LSB和特定版本的相关信息。
这个命令适用于所有的linux,包括Redhat、SuSE、Debian、Centos等发行版。-a
, --all
就是显示所有信息,显示包括版本信息、发行版的ID、发行版的描述信息、具体版本号、发行版代号的信息。
<code class="bash" data-origin="# yum install -y redhat-lsb-core
lsb_release -d
Description: CentOS Linux release 7.1.1503 (Core)
lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
" style="border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 1em; letter-spacing: -1px; font-weight: bold;"># yum install -y redhat-lsb-core
# lsb_release -d
Description: CentOS Linux release 7.1.1503 (Core)
# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
lsb_release
的具体可以用lsb_release -h
查看帮助
-i, --id
Display the string id of the distributor.
-d, --description
Display the single line text description of the distribution.
-r, --release
Display the release number of the distribution.
-c, --codename
Display the codename according to the distribution release.
-a, --all
Display all of the above information.
-s, --short
Use short output format for information requested by other options (or version if none).
3. 查看系统是64位还是32位
x86_64 是 64位
i386 i686 都是32位
# uname -i
x86_64
也可以通过file
命令查看系统命令来确定。
# 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
参考
![](https://image.shishitao.com:8440/aHR0cHM6Ly9pbWcyMDIyLmNuYmxvZ3MuY29tL2Jsb2cvMzU2OTUvMjAyMjAyLzM1Njk1LTIwMjIwMjE3MjI1MTMzMTg3LTEwMDkyNTk0NTguanBn.jpg?w=700&webp=1)