Linux下查看CPU、内存、硬盘等信息
一、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@R4 ~]# cat /proc/meminfo |grep MemTotal
MemTotal: 32941268 kB
//32G内存
三、硬盘大小
[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