查看linux系统版本和cpu

cat /proc/version

cat /etc/issue

uname -a

uname -r

lsb_release -a

cat /etc/redhat-release

file /bin/bash

示例:

[root@private ~]# cat /proc/version
Linux version 3.10.0-693.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Aug 22 21:09:27 UTC 2017
[root@private ~]# uname -a
Linux private.ca.sensetime.com 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@private ~]# uname -r
3.10.0-693.el7.x86_64
[root@private ~]# lsb_release -a
-bash: lsb_release: 未找到命令
[root@private ~]# cat /etc/issue
\S
Kernel \r on an \m

[root@private ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[root@private ~]# file /bin/bash
/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=e1df4babc39e931279d37a050884e2b7b095ff39, stripped
[root@private ~]#

 

# 总核数 = 物理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

 

posted @ 2021-05-08 10:40  kimiandkevin  阅读(266)  评论(0编辑  收藏  举报