lshw可以查看服务器硬件配置的详细信息,可以在支持DMI的x86或者IA-64系统以及power PC 机器上打印内存配置,固件版本,主板配置,cpu版本,cpu频次,缓存,总线速度等信息。
[root@ecs-c13b ~]# lshw -helpHardware Lister (lshw) - B.012.18 usage: lshw [-format] [-options ...] lshw -version -version print program version (B.012.18)(查看版本信息)format can be -html output hardware tree as HTML (将设备树输出信息保存为HTML格式) -xml output hardware tree as XML (保存为XML格式) -json output hardware tree as a JSON object (保存为json格式) -short output hardware paths (输出简短显示硬件路径的设备树信息) -businfo output bus information (输出总线信息的设备列表) options can be -dump OUTFILE save hardware tree to a file -class CLASS only show a certain class of hardware -C CLASS same as '-class CLASS' -c CLASS same as '-class CLASS' -disable TEST disable a test (like pci, isapnp, cpuid, etc. )(禁用某些检测) -enable TEST enable a test (like pci, isapnp, cpuid, etc. ) -quiet don't display status (不显示状态) -sanitize sanitize output (remove sensitive information like serial numbers, etc.) (从输出信息中删除可能敏感的信息,如IP地址,序列号) -numeric output numeric IDs (for PCI, USB, etc.) (显示数字ID) -notime exclude volatile attributes (timestamps) from output[root@ecs-c13b ~]#
其中:
lsblk查看磁盘的设备名称和容量的对应关系
[root@ecs-c13b ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 40G 0 disk └─vda1 253:1 0 40G 0 part /
[root@ecs-c13b ~]# ip addr1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether fa:16:3e:5a:31:dd brd ff:ff:ff:ff:ff:ff inet 192.168.0.192/24 brd 192.168.0.255 scope global dynamic noprefixroute eth0 valid_lft 57710sec preferred_lft 57710sec inet6 fe80::f816:3eff:fe5a:31dd/64 scope link valid_lft forever preferred_lft forever
[root@ecs-c13b ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 40G 0 disk └─vda1 253:1 0 40G 0 part /[root@ecs-c13b ~]# ip addr1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether fa:16:3e:5a:31:dd brd ff:ff:ff:ff:ff:ff inet 192.168.0.192/24 brd 192.168.0.255 scope global dynamic noprefixroute eth0 valid_lft 57710sec preferred_lft 57710sec inet6 fe80::f816:3eff:fe5a:31dd/64 scope link valid_lft forever preferred_lft forever[root@ecs-c13b ~]# 使用lshw命令可以生成一个详尽的HTML格式文件,使用浏览器打开之后更容易查看到设备型号信息。[root@ecs-c13b ~]# lshw -shortH/W path Device Class Description===================================================== system OpenStack Nova /0 bus Motherboard /0/0 memory 96KiB BIOS 内存 /0/400 processor Intel(R) Xeon(R) Gold 6266C CPU @ 3.00GHz (CPU型号) /0/1000 memory 4GiB System Memory /0/1000/0 memory 4GiB DIMM RAM /0/100 bridge 440FX - 82441FX PMC [Natoma]/0/100/1 bridge 82371SB PIIX3 ISA [Natoma/Triton II]/0/100/1.1 storage 82371SB PIIX3 IDE [Natoma/Triton II]/0/100/1.2 bus 82371SB PIIX3 USB [Natoma/Triton II]/0/100/1.2/1 usb1 bus UHCI Host Controller /0/100/1.2/1/1 input QEMU USB Tablet /0/100/1.3 bridge 82371AB/EB/MB PIIX4 ACPI /0/100/2 display GD 5446 /0/100/3 network Virtio network device /0/100/3/0 eth0 network Ethernet interface /0/100/4 bridge QEMU PCI-PCI bridge /0/100/5 bridge QEMU PCI-PCI bridge /0/100/5/1 storage Virtio block device /0/100/5/1/0 /dev/vda disk 42GB Virtual I/O device /0/100/5/1/0/1 /dev/vda1 volume 39GiB EXT4 volume /0/100/6 bridge QEMU PCI-PCI bridge /0/100/7 bridge QEMU PCI-PCI bridge /0/100/8 bridge QEMU PCI-PCI bridge /0/100/9 bridge QEMU PCI-PCI bridge /0/100/a bridge QEMU PCI-PCI bridge /0/100/b bridge QEMU PCI-PCI bridge /0/100/c communication Virtio console /0/100/c/0 generic Virtual I/O device /0/100/d generic Virtio memory balloon /0/100/d/0 generic Virtual I/O device /0/1 system PnP device PNP0b00 /0/2 input PnP device PNP0303 /0/3 input PnP device PNP0f13 /0/4 storage PnP device PNP0700 /0/5 communication PnP device PNP0501[root@ecs-c13b ~]#