当前位置:首页 > Liunx教程 >

linux查看硬件信息命令

发布时间:2023-09-04 09:22:56 作者:佚名 阅读:(12)

在使用Linux系统的时候,我们有时候需要查看服务器硬件相关信息,接下来云梦编程为大家详细的介绍一下linux查看硬件信息命令,有需要的小伙伴可以参考一下:

linux查看硬件信息命令

1、查看服务器硬件信息

    (1)、查看服务器型号、序列号

[root@localhost ~]# dmidecode|grep "System Information" -A9|egrep  "Manufacturer|Product|Serial"
    Manufacturer: VMware, Inc.
    Product Name: VMware Virtual Platform
    Serial Number: VMware-56 4d d3 e0 c1 fe 00 9c-05 a5 96 0d f7 45 c5 04

    (2)、查看主板型号

[root@localhost ~]# dmidecode |grep -A16 "System Information$"

linux查看硬件信息命令

    (3)、查看BIOS信息

[root@localhost ~]# dmidecode -t bios
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
    Vendor: Phoenix Technologies LTD
    Version: 6.00
    Release Date: 07/03/2018
    Address: 0xEA520
    Runtime Size: 88800 bytes
    ROM Size: 64 kB
    Characteristics:
        ISA is supported
        PCI is supported
        PC Card (PCMCIA) is supported
        PNP is supported
        APM is supported
        BIOS is upgradeable
        BIOS shadowing is allowed
        ESCD support is available
        Boot from CD is supported
        Selectable boot is supported
        EDD is supported
        Print screen service is supported (int 5h)
        8042 keyboard services are supported (int 9h)
        Serial services are supported (int 14h)
        Printer services are supported (int 17h)
        CGA/mono video services are supported (int 10h)
        ACPI is supported
        Smart battery is supported
        BIOS boot specification is supported
        Function key-initiated network boot is supported
        Targeted content distribution is supported
    BIOS Revision: 4.6
    Firmware Revision: 0.0

    (4)、查看内存槽及内存条

linux查看硬件信息命令

    (5)、查看网卡信息:

[root@c45088 ~]# dmesg | grep -i Ethernet
[    3.911619] xen_netfront: Initialising Xen virtual ethernet driver

    (6)、查看pci信息,即主板所有硬件槽信息

linux查看硬件信息命令

2、查看CPU信息

    (1)、查看cpu型号:

[root@localhost ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
      2  Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz

    (2)、查看系统中实际物理CPU的数量(物理)

[root@localhost ~]# grep 'physical id' /proc/cpuinfo | sort | uniq | wc -l
2

    (3)、系统中实际物理CPU的数量(核数)

[root@localhost ~]# cat /proc/cpuinfo |grep 'processor'|wc -l
4

    (4)、查看每个物理CPU中core的个数(即核数)

[root@localhost ~]# cat /proc/cpuinfo |grep "cores"|uniq
cpu cores    : 1

    (5)、查看CPU的主频

[root@localhost ~]# cat /proc/cpuinfo |grep MHz|uniq
cpu MHz        : 3912.000

    (6)、查看CPU的详细信息

[root@localhost ~]# cat /proc/cpuinfo |grep MHz|uniq
cpu MHz        : 3912.000
[root@localhost ~]# cat /proc/cpuinfo | head -20
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 158
model name    : Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz
stepping    : 9
microcode    : 0x8e
cpu MHz        : 3912.000
cache size    : 3072 KB
physical id    : 0
siblings    : 1
core id        : 0
cpu cores    : 1
apicid        : 0
initial apicid    : 0
fpu        : yes
fpu_exception    : yes
cpuid level    : 22
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities

    (7)、查看CPU的相关信息

[root@localhost ~]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    1
座:                 2
NUMA 节点:         1
厂商 ID:           GenuineIntel
CPU 系列:          6
型号:              158
型号名称:        Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz
步进:              9
CPU MHz:             3912.000
BogoMIPS:            7824.00
超管理器厂商:  VMware
虚拟化类型:     完全
L1d 缓存:          32K
L1i 缓存:          32K
L2 缓存:           256K
L3 缓存:           3072K
NUMA 节点0 CPU:    0,1
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities

    (8)、查看cpu运行模式

[root@localhost ~]# getconf LONG_BIT
64

    (9)、查看cpu是否支持64bit

[root@localhost ~]# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
2
(结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit)

3、查看内存信息

    (1)、最大支持多少内存

[root@localhost ~]# dmidecode|grep -P 'Maximum\s+Capacity'
    Maximum Capacity: 2 GB

    (2)、Linux 查看内存的插槽数,已经使用多少插槽.每条内存多大

linux查看硬件信息命令

    (3)、Linux 查看内存的频率:

linux查看硬件信息命令

    (4)、Linux 查看内存的详细信息:

linux查看硬件信息命令

    (5)、Linux 查看内存的使用情况

[root@localhost ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           1838         427         669          21         741        1192
Swap:          3999         420        3579

4、查看硬盘信息

    (1)、查看挂接的分区状态

[root@c45088 ~]# fdisk -l |grep Disk
Disk /dev/xvda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Disk label type: dos
Disk identifier: 0x000c54c1
Disk /dev/xvdb: 32.2 GB, 32212254720 bytes, 62914560 sectors
Disk label type: dos
Disk identifier: 0x3588ad2f

    (2)、查看硬盘和分区分布:

linux查看硬件信息命令

    (3)、查看硬盘和分区的详细信息

linux查看硬件信息命令

    (4)、查看挂接的分区状态

linux查看硬件信息命令

    (5)、查看挂接的分区状态

[root@localhost ~]# swapon -s
文件名                类型        大小    已用    权限
/dev/dm-1                                  partition    4095996    430336    -1

    (6)、查看硬盘使用情况

linux查看硬件信息命令

    (7)、硬盘检测命令smartctl

smartctl -a /dev/sda

5、查看网卡信息

    (1)、查看网卡硬件信息

[root@localhost ~]# lspci | grep -i 'eth'
05:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
05:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)

    (2)、查看系统的所有网络接口

[root@localhost ~]# ifconfig -a
[root@localhost ~]# ip link show

    (3)、查看某个网络接口的详细信息,例如eth0的详细参数和指标

[root@localhost ~]# ethtool eth0
Settings for eth0:
    Link detected: yes

    (4)、查看所有网卡的链路状态

[root@localhost ~]# for i in `seq 0 9`;do ethtool eth${i} | egrep 'eth|Link';done
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth0:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth1:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth2:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth3:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth4:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth5:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth6:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth7:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth8:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
Settings for eth9:

6、列出所有PCI设备信息:

[root@localhost ~]# lspci -tv | more
-[0000:00]-+-00.0  Intel Corporation 440FX - 82441FX PMC [Natoma]
           +-01.0  Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
           +-01.1  Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
           +-01.2  Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II]
           +-01.3  Intel Corporation 82371AB/EB/MB PIIX4 ACPI
           +-02.0  Cirrus Logic GD 5446
           +-03.0  Red Hat, Inc. Virtio network device
           +-04.0  Red Hat, Inc. Virtio console
           +-05.0  Red Hat, Inc. Virtio block device
           \-06.0  Red Hat, Inc. Virtio memory balloon

以上就是云梦编程为大家介绍的关于Linux查看硬件信息命令的全部内容了,希望对大家有所帮助,了解更多相关文章请关注云梦编程网!

© 2023 - 云梦编程网 版权所有 鲁ICP备2021017318号-4