Linux下查看CPU、内存、硬盘等信息

时间:2022-12-23 10:06:16

原文:http://www.weiruoyu.cn/?p=723

一、CPU大小
[root@R4 ~]# cat /proc/cpuinfo |grep "model name" && cat /proc/cpuinfo |grep "physical id"
model name : Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
model name : Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
model name : Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
model name : Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
model name : Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
model name : Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
model name : Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
model name : Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
physical id : 0
physical id : 1
physical id : 0
physical id : 1
physical id : 0
physical id : 1
physical id : 0
physical id : 1
//两个4核的CPU
//通过有几个不同的"physical id"来判定CPU个数

[root@localhost ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
4 Intel(R) Xeon(R) CPU E5506 @ 2.13GHz


二、内存大小
[root@R4 ~]# cat /proc/meminfo |grep MemTotal
MemTotal: 32941268 kB
//32G内存

查看简要内存信息
/usr/sbin/dmidecode | grep -A 16 "Memory Device" | grep -E "Size|Locator" | grep -v Bank


三、硬盘大小
[root@R4 ~]# fdisk -l |grep Disk
Disk /dev/sda: 1887.4 GB, 1887436800000 bytes
Disk /dev/sdb: 1860.5 GB, 1860593254400 bytes
//2块1.8T硬盘

四、Swap空间
[root@R4 ~]# grep SwapTotal /proc/meminfo
SwapTotal: 10223608 kB


查看CUP信息
# cat /proc/cpuinfo

显示每个cpu的详细信息
/usr/sbin/dmidecode | grep -A55 'Processor Information'

显示cpu简要信息
/usr/sbin/dmidecode | grep -A55 'Processor Information' | grep -E "Socket|Version"

查看扩展卡
/usr/sbin/dmidecode | grep -A3 "On Board Device"

查看内存
显示每个插槽,及插槽中内存的信息
/usr/sbin/dmidecode | grep -A 16 "Memory Device"



查看网卡速率
dmesg | grep ^eth

参考:http://www.weiruoyu.cn/?p=723