linux中查看系统版本信息的方法

Linux 小智 269℃ 0评论

前言

测试环境:测试环境: centos7.2 64位
测试用户:root

查看系统位数(32位或64位)

方法1:

[root@VM_0_13_centos ~]# uname -a
Linux VM_0_13_centos 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

方法2:显示系统程序信息

[root@VM_0_13_centos ~]# 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:

[root@VM_0_13_centos ~]# cat /proc/version
Linux version 3.10.0-514.26.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Jul 4 15:04:05 UTC 2017

方法4:
(32位的系统中int类型和long类型一般都是4字节,64位的系统中int类型还是4字节的,但是long已变成了8字节inux系统中可用”getconf WORD_BIT”和
“getconf LONG_BIT”获得word和long的位数。64位系统中应该分别得到32和64)

[root@VM_0_13_centos ~]# getconf LONG_BIT
64

查看系统版本

方法1:

[root@VM_0_13_centos ~]# lsb_release -a
-bash: lsb_release: command not found

显示此命令不可用,原因是lsb_release并未安装,安装lsb_release过程可查看下面这篇文章
CentOS 7 命令lsb_release: command not found解决方案

方法2:

[root@VM_0_13_centos ~]# 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:

[root@VM_0_13_centos ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 

方法4:

[root@VM_0_13_centos ~]# rpm -q centos-release
centos-release-7-2.1511.el7.centos.2.10.x86_64

查看内核版本

方法1:

[root@VM_0_13_centos ~]# cat /proc/version
Linux version 3.10.0-514.26.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Jul 4 15:04:05 UTC 2017

方法2:

[root@VM_0_13_centos ~]# uname -a
Linux VM_0_13_centos 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

本文固定链接:心知博客 » linux中查看系统版本信息的方法
本站内容除特别标注外均为原创,欢迎转载,但请保留出处!

喜欢 (1)
发表我的评论
取消评论
表情

请填写您的昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址