日期:2014-05-16  浏览次数:20704 次

linux下查看cpu、内存、硬盘等硬件信息
一、CPU大小
[root@idc ~]# cat /proc/cpuinfo |grep "model name" && cat /proc/cpuinfo |grep "physical id"
model name: Intel(R) Xeon(TM) CPU 2.80GHz
model name: Intel(R) Xeon(TM) CPU 2.80GHz
model name: Intel(R) Xeon(TM) CPU 2.80GHz
model name: Intel(R) Xeon(TM) CPU 2.80GHz
physical id    : 0
physical id    : 0
physical id    : 3
physical id    : 3
[root@idc ~]#

说明:Linux下可以在/proc/cpuinfo中看到每个cpu的详细信息。但是对于双核的cpu,在cpuinfo中会看到两个cpu。常常会让人误以为是两个单核的cpu。

其实应该通过Physical Processor ID来区分单核和双核。而Physical Processor ID可以从cpuinfo或者dmesg中找到.
flags 如果有 ht 说明支持超线程技术
判断物理CPU的个数可以查看physical id 的值,相同则为同一个物理CPU

可以看到上面,这台机器有两个双核的CPU,ID分别是0和3,大小是2.8G。

二、内存大小
[root@xbidc ~]# cat /proc/meminfo |grep MemTotal
MemTotal:              1034612 kB
[root@xbidc ~]#
三、硬盘大小
[root@xbidc ~]# fdisk -l |grep Disk
Disk /dev/sda: 300.0 GB, 300000000000 bytes
[root@xbidc ~]#
[root@wds ~]# ethtool -i eth0
  driver: pcnet32

  version: 1.31

  firmware-version:

  bus-info: 0000:00:11.0

  [root@wds ~]# ethtool -k eth0

  Offload parameters for eth0:

  Cannot get device rx csum settings: Operation not supported

  rx-checksumming: off

  tx-checksumming: off

  scatter-gather: off

  tcp segmentation offload: off

  [root@wds ~]# ethtool -g eth0

  Ring parameters for eth0:

  Pre-set maximums:

  RX:       511

  RX Mini:    0

  RX Jumbo:    0

  TX:       511

  Current hardware settings:

  RX:       31

  RX Mini:    0

  RX Jumbo:    0

  TX:       15

  [root@wds ~]#