在linux中查询硬件相关信息

时间:2023-03-09 00:29:15
在linux中查询硬件相关信息

1、查询cpu的相关

  a、查询CPU的统计信息

  使用命令:lscpu

  得到的结果如下:

  

Architecture:          x86_64
CPU op-mode(s): -bit, -bit
Byte Order: Little Endian
CPU(s):
On-line CPU(s) list: -
Thread(s) per core:
Core(s) per socket:
Socket(s):
NUMA node(s):
Vendor ID: GenuineIntel
CPU family:
Model:
Stepping:
CPU MHz: 2099.939
BogoMIPS: 4199.44
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 15360K
NUMA node0 CPU(s): -
NUMA node1 CPU(s): -

  b、查询每个CPU信息  

  使用的命令:cat /proc/cpuinfo

  得到如下结果:

processor    :
vendor_id : GenuineIntel
cpu family :
model :
model name : Intel(R) Xeon(R) CPU E5- v2 @ .10GHz
stepping :
cpu MHz : 2099.939
cache size : KB
physical id :
siblings :
core id :
cpu cores :
apicid :
initial apicid :
fpu : yes
fpu_exception : yes
cpuid level :
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips : 4199.87
clflush size :
cache_alignment :
address sizes : bits physical, bits virtual
power management: processor :
vendor_id : GenuineIntel
cpu family :
model :
model name : Intel(R) Xeon(R) CPU E5- v2 @ .10GHz
stepping :
cpu MHz : 2099.939
cache size : KB
physical id :
siblings :
core id :
cpu cores :
apicid :
initial apicid :
fpu : yes
fpu_exception : yes
cpuid level :
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips : 4199.87
clflush size :
cache_alignment :
address sizes : bits physical, bits virtual
power management: processor :
vendor_id : GenuineIntel
cpu family :
model :
model name : Intel(R) Xeon(R) CPU E5- v2 @ .10GHz
stepping :
cpu MHz : 2099.939
cache size : KB
physical id :
siblings :
core id :
cpu cores :
apicid :
initial apicid :
fpu : yes
fpu_exception : yes
cpuid level :
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips : 4199.87
clflush size :
cache_alignment :
address sizes : bits physical, bits virtual
power management:

2、查询所有的pci设备信息(pci是一种总线,而通过pci总线连接的设备就是pci设备了,如今,我们常用的设备很多都采用pci总线了,如网卡存储等)

  使用命令:lspci

  得到结果:

:00.0 Host bridge: Intel Corporation Xeon E5 v2/Core i7 DMI2 (rev )
:01.0 PCI bridge: Intel Corporation Xeon E5 v2/Core i7 PCI Express Root Port 1a (rev )
:01.1 PCI bridge: Intel Corporation Xeon E5 v2/Core i7 PCI Express Root Port 1b (rev )
:02.0 PCI bridge: Intel Corporation Xeon E5 v2/Core i7 PCI Express Root Port 2a (rev )
:03.0 PCI bridge: Intel Corporation Xeon E5 v2/Core i7 PCI Express Root Port 3a (rev )
:03.2 PCI bridge: Intel Corporation Xeon E5 v2/Core i7 PCI Express Root Port 3c (rev )
:04.0 System peripheral: Intel Corporation Xeon E5 v2/Core i7 Crystal Beach DMA Channel (rev )
:04.1 System peripheral: Intel Corporation Xeon E5 v2/Core i7 Crystal Beach DMA Channel (rev )
:04.2 System peripheral: Intel Corporation Xeon E5 v2/Core i7 Crystal Beach DMA Channel (rev )
:04.3 System peripheral: Intel Corporation Xeon E5 v2/Core i7 Crystal Beach DMA Channel (rev )
:04.4 System peripheral: Intel Corporation Xeon E5 v2/Core i7 Crystal Beach DMA Channel (rev )
:04.5 System peripheral: Intel Corporation Xeon E5 v2/Core i7 Crystal Beach DMA Channel (rev )
:04.6 System peripheral: Intel Corporation Xeon E5 v2/Core i7 Crystal Beach DMA Channel (rev )
:04.7 System peripheral: Intel Corporation Xeon E5 v2/Core i7 Crystal Beach DMA Channel (rev )
:05.0 System peripheral: Intel Corporation Xeon E5 v2/Core i7 VTd/Memory Map/Misc (rev )
:05.2 System peripheral: Intel Corporation Xeon E5 v2/Core i7 IIO RAS (rev )
:05.4 PIC: Intel Corporation Xeon E5 v2/Core i7 IOAPIC (rev )
:11.0 PCI bridge: Intel Corporation C600/X79 series chipset PCI Express Virtual Root Port (rev )
:16.0 Communication controller: Intel Corporation C600/X79 series chipset MEI Controller # (rev )
:16.1 Communication controller: Intel Corporation C600/X79 series chipset MEI Controller # (rev )
:1a. USB controller: Intel Corporation C600/X79 series chipset USB2 Enhanced Host Controller # (rev )
:1d. USB controller: Intel Corporation C600/X79 series chipset USB2 Enhanced Host Controller # (rev )
:1e. PCI bridge: Intel Corporation PCI Bridge (rev a6)
:1f. ISA bridge: Intel Corporation C600/X79 series chipset LPC Controller (rev )
:1f. SATA controller: Intel Corporation C600/X79 series chipset -Port SATA AHCI Controller (rev )
:1f. SMBus: Intel Corporation C600/X79 series chipset SMBus Host Controller (rev )
:1f. Signal processing controller: Intel Corporation C600/X79 series chipset Thermal Management Controller (rev )
:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev )
:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev )
:00.0 Network controller: Mellanox Technologies MT27500 Family [ConnectX-]
:04.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0a)

如果要利用lscpi查询网卡型号可以使用命令:lspci |grep Ethernet

得到结果:

:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev )
:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev )

3、查询内存相关信息

  a、查看内存大小

  使用命令:free

  得到内存的一个整体信息如下:

             total       used       free     shared    buffers     cached
Mem:
-/+ buffers/cache:
Swap:

  b、查看详细信息

  使用命令:cat /proc/meminfo

  结果:

MemTotal:        kB
MemFree: kB
Buffers: kB
Cached: kB
SwapCached: kB
Active: kB
Inactive: kB
Active(anon): kB
Inactive(anon): kB
Active(file): kB
Inactive(file): kB
Unevictable: kB
Mlocked: kB
SwapTotal: kB
SwapFree: kB
Dirty: kB
Writeback: kB
AnonPages: kB
Mapped: kB
Shmem: kB
Slab: kB
SReclaimable: kB
SUnreclaim: kB
KernelStack: kB
PageTables: kB
NFS_Unstable: kB
Bounce: kB
WritebackTmp: kB
CommitLimit: kB
Committed_AS: kB
VmallocTotal: kB
VmallocUsed: kB
VmallocChunk: kB
HardwareCorrupted: kB
AnonHugePages: kB
HugePages_Total:
HugePages_Free:
HugePages_Rsvd:
HugePages_Surp:
Hugepagesize: kB
DirectMap4k: kB
DirectMap2M: kB
DirectMap1G: kB

4、查看系统内核相关信息

  使用命令:uname -a

  结果:

Linux cn13 2.6.-.el6.x86_64 # SMP Sun Nov  :: EST  x86_64 x86_64 x86_64 GNU/Linux

  查看系统版本

  使用命令:cat /etc/issue

  结果:

Red Hat Enterprise Linux Server release 6.5 (Santiago)

5、利用dmindecode查看硬件信息

查看服务器型号
dmidecode | grep 'product name'
查看主板序列号
dmidecode | grep 'Serial Number'
查看系统序列号
dmidecode -s systems-serial-number
查看内存信息
dmidecode -t memory
查看oem信息
dmidecode -t 11

**6、利用ibstat查看infiniband网卡的信息:

结果:

CA 'mlx4_0'
CA type: MT4099
Number of ports:
Firmware version: 2.30.
Hardware version:
Node GUID: 0x002590fffff7761c
System image GUID: 0x002590fffff7761f
Port :
State: Active
Physical state: LinkUp
Rate:
Base lid:
LMC:
SM lid:
Capability mask: 0x02514868
Port GUID: 0x002590fffff7761d
Link layer: InfiniBand

相关文章