Linux检查和收集硬件信息的常⽤命令总结
Linux检查和收集硬件信息的常⽤命令总结
作者:尹正
杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
Linux基础真的很重要,基础不牢,地动⼭摇。这句话我是听⽼男孩创始⼈冉总说的⼀句话,起初我也不以为然。直到最近我kafka集出现丢数
据的情况,花了3天时间才查明⽩原因,是由于我磁盘IO到达瓶颈导致。⽽这个还是我通过运维同事部署的zabbix监控系统查出来的异常。当我登录
操作系统竟然⼀时间竟然想不起⽤啥命令去查看相应的信息,于是我花费半天的时间恶补了⼀些基础,把常⽤的⼀些基础命令总结⼀下。
⼀.lscpu # ⽤于查询CPU信息
[root@node105 ~]# lscpu
Architecture: x86_64 #CPU架构
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 20 #逻辑cpu颗数
On-line CPU(s) list: 0-19
Thread(s) per core: 1 #每个CPU插槽核数/每颗物理CPU核数
Core(s) per socket: 10
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel #CPU⼚商ID
CPU family: 6
Model: 79
Model name: Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
Stepping: 1
CPU MHz: 2095.148 #CPU主频
BogoMIPS: 4190.29
Hypervisor vendor: VMware
Virtualization type: full #CPU⽀持的虚拟化技术
L1d cache: 32K #⼀级缓存。cpu的L1数据缓存
L1i cache: 32K #⼀级缓存,L1指令缓存
L2 cache: 256K #⼆级缓存
L3 cache: 20480K #三级缓存
NUMA node0 CPU(s): 0-9
NUMA node1 CPU(s): 10-19
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf ea [root@node105 ~]#
⼆. lshw # ⽤于显⽰硬件信息表([root@node105 ~]# yum -y install lshw)
[root@node105 ~]# lshw | more
三.lsblk # ⽤于列出块设备的信息
[root@node105 ~]# lsblk
四.lsscsi # ⽤于列出SCSI的设备信息
[root@node105 ~]# lsscsi
五.fdisk #看硬盘和分区的详细信息
[root@node105 ~]# fdisk -l
六.ethtool #查看某个⽹络接⼝的详细信息,例如eth0的详细参数和指标
[root@kafka116 ~]# ethtool enp7s0f0 #注意,这⾥的enp7s0f0是⽹卡的名称kafka命令
Settings for enp7s0f0:
Supported ports: [ TP ]
Supported link modes: 100baseT/Full
1000baseT/Full
10000baseT/Full #⽀持万兆全双⼯模式
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes #⽀持⾃适应模式,⼀般都⽀持
Supported FEC modes: Not reported
Advertised link modes: 100baseT/Full
1000baseT/Full
10000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes #默认使⽤⾃适应模式
Advertised FEC modes: Not reported
Speed: 10000Mb/s #现在⽹卡的速度是万兆Mb/s,
Duplex: Full #当前是全双⼯模式
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes #表⽰有⽹线连接,和路由是通的,这可以使⽤“ifconfig”或者“ip a”查看操作系统中⽹卡的是否是UP状态。
[root@kafka116 ~]#
七.dmidecode #⼀种可读的⽅式dump出机器的DMI(Desktop Management Interface)信息。这些信息包括了硬件以及BIOS,既可以得到当前的配置,也可以得到系统⽀持的最⼤配置,⽐如说⽀持的最⼤内
存数等。
[root@kafka116 ~]# dmidecode -t bios #查看bios信息
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 3.0 present.
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: American Megatrends Inc.
Version: 4.1.16
Release Date: 06/21/2018
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 8192 kB
Characteristics:
PCI is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
BIOS ROM is socketed
EDD is supported
5.25"/1.2 MB floppy services are supported (int 13h)
3.5"/720 kB floppy services are supported (int 13h)
3.5"/2.88 MB floppy services are supported (int 13h)
Print screen service is supported (int 5h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
ACPI is supported
USB legacy is supported
BIOS boot specification is supported
Targeted content distribution is supported
UEFI is supported
BIOS Revision: 5.6
Handle 0x0066, DMI type 13, 22 bytes
BIOS Language Information
Language Description Format: Long
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1
[root@kafka116 ~]#
⼋.free #概要查看内存情况,他的数据来⾃“/etc/meminfo”中
[root@kafka116 ~]# free -h #该参数可以⾃动帮我们以合适的单位显⽰数据的⼤⼩
total used free shared buff/cache available
Mem: 31G 8.6G 232M 20M 22G 22G
Swap: 15G 993M 14G
[root@kafka116 ~]#
[root@kafka116 ~]#
[root@kafka116 ~]#
[root@kafka116 ~]# free -m #该参数表⽰所有的数据都得以Mb为单位显⽰
total used free shared buff/cache available
Mem: 318678791201202287522533
Swap: 1606399315070
[root@kafka116 ~]#
[root@kafka116 ~]#
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论