在使用Linux操作系统的时候,有时候会需要了解当前使用的系统版本信息,特别是在给别人进行服务器部署运维的时候,准确的系统版本信息至关重要
查看linux内核版本信息:
- 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. uname -a
Linux dajiala_b 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. 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
这个命令适用于所有的Linux发行版,包括RedHat、SUSE、Debian…等发行版。
2. cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
这种方法只适合Redhat系的Linux
3.cat /etc/issue
S
Kernel
on an m
此命令也适用于所有的Linux发行版
4. 查看CPU核数
总核数 = 物理CPU个数 X 每颗物理CPU的核心数 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 #查看物理CPU个数 cat /proc/cpuinfo |grep "physical id"| sort | uniq| wc -l # 查看每个物理CPU中的core的核数 cat /proc/cpuinfo | grep "cpu cores"|uniq # 查看逻辑CPU的个数 cat /proc/cpuinfo | grep "processor" | wc -l
lscpu