幾種查看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
