检查和收集 Linux 硬件信息的 7 个命令

橙子系统为您提供
Linux系统中,有许多命令可用于查询主机硬件信息。一些命令只针对特定的硬件组件,比如CPU、内存,一些命令可以查询多硬件信息。这篇文章只是简单的让每个人了解查询硬件信息的基本命令使用,包括lscpu、hwinfo、lshw、lspci、lsblk、lsusb等等。1. lscpu用于查询CPU信息[root@devops ~]# lscpuArchitecture: x86_64CPU op-mode(s): 32-bit, 64-bitByte Order: Little EndianCPU(s): 1On-line CPU(s) list: 0Thread(s) per core: 1Core(s) per socket: 1CPU socket(s): 1NUMA node(s): 1Vendor ID: GenuineIntelCPU family: 6Model: 45Stepping: 7CPU MHz: 2194.842BogoMIPS: 4389.68Hypervisor vendor: XenVirtualization type: fullL1d cache: 32KL1i cache: 32KL2 cache: 256KL3 cache: 15360KNUMA node0 CPU(s): 02. lshw显示硬件信息表这个命令应用普遍,它可通过个人需求而列出多种不同的硬件参数:CPU、内存、硬盘、USB控制器、lshw卡片等等,本质上就是从/proc目录不同文件中中提取对应的硬件信息。按照下面的步骤去安装lshw工具,然后就可以使用了。wget http://ezix.org/software/files/lshw-B.02.14.tar.gztar -zxvf lshw-B.02.14.tar.gzcd lshw-B.02.14make && make install示例:[root@devops lshw-B.02.14]# lshw -shortH/W path Device Class Description=====================================================system HVM domU/0 bus Motherboard/0/0 memory 96KiB BIOS/0/1 processor Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz/0/2 memory System Memory/0/2/0 memory 512MiB DIMM RAM/0/2/1 memory 512MiB DIMM RAM/0/3 memory 96KiB BIOS/0/4 processor CPU/0/5 memory System Memory/0/6 memory/0/7 memory

/0/100bridge440FX-82441FXPMC[Natoma]
/0/100/1bridge82371SBPIIX3ISA[Natoma/TritonII]
/0/100/1.1scsi1storage82371SBPIIX3IDE[Natoma/TritonII]
/0/100/1.1/0.0.0/dev

rom1diskSCSICD-ROM
/0/100/1.2bus82371SBPIIX3USB[Natoma/TritonII]
/0/100/1.2/1usb1busUHCIHostController
/0/100/1.2/1/2inputQEMUUSBTablet
/0/100/1.3bridge82371AB/EB/MBPIIX4ACPI
/0/100/2displayGD5446
/0/100/3genericXenPlatformDevice
/1eth0networkEthernetinterface
/2eth1networkEthernetinterface
[root@devopslshw-B.02.14]#
3.hwinfo-硬件信息
hwinfo类似于lshw,也能查询硬件信息,且应用广泛。它也能输出多个硬件部分的详细或者简要信息,但是不同的是有时hwinfo比lshw的信息更详细。
默认情况下,Linux系统没有安装hwinfo工具,所以你需要按照以下步骤自己安装:
CentOS6
#rpm-Uvhhttp://mirror.symnds.com/distributions/gf/el/6/gf/x86_64/gf-release-6-6.gf.el6.noarch.rpm
#yumlisthwinfo
#yuminstallhwinfo
CentOS5
#rpm-Uvhhttp://mirror.symnds.com/distributions/gf/el/5/gf/x86_64/gf-release-5-6.gf.el5.noarch.rpm
#yumlisthwinfo
#yuminstallhwinfo
[root@devopstmp]#rpm-Uvhhttp://mirror.symnds.com/distributions/gf/el/6/gf/x86_64/gf-release-6-6.gf.el6.noarch.rpm
Retrievinghttp://mirror.symnds.com/distributions/gf/el/6/gf/x86_64/gf-release-6-6.gf.el6.noarch.rpm
warning:

ar/tmp/rpm-tmp.m2mMAO:HeaderV4RSA/SHA1Signature,keyID13a4d2a9:NOKEY
Preparing…###########################################[100%]
1:gf-release###########################################[100%]
[root@devopstmp]#yumlisthwinfo
Loadedplugins:fastestmirror
Loadingmirrorspeedsfromcachedhostfile
*base:mirrors.aliyun.com
*extras:mirrors.aliyun.com
*updates:mirrors.aliyun.com
gf
00:00
gf/primary_db
00:00AvailablePackages
检查收集 Linux 硬件信息的 7 个命令(3)2014-05-23 21:48|来源:本站搜集整理 |作者:dnzg |点击: 1921 次hwinfo.x86_64[root@devops tmp]# yum list hwinfoLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.comgf 00:00 gf/primary_db 00:00 Available Packageshwinfo.x86_64 20.2-1.gf.el6[root@devops tmp]# yum install hwinfoLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.comSetting up Install ProcessResolving Dependencies–> Running transaction check—> Package hwinfo.x86_64 0:20.2-1.gf.el6 will be installed…..示例:[root@devops tmp]# hwinfo -shortoops: don't know what to do with "short"[root@devops tmp]# hwinfo –shortcpu: Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz, 2194 MHzkeyboard: /dev/input/event3 AT Translated Set 2 keyboard /dev/ttyS0 serial consolemouse: /dev/input/mice Adomax QEMU USB Tablet /dev/input/mice Macintosh mouse button emulation /dev/input/mice ImExPS/2 Generic Explorer Mousegraphics card: Cirrus Logic GD 5446storage: Intel 82371SB PIIX3 IDE [Natoma/Triton II] Xen Virtual Storage 0 Xen Virtual Storage 1 Xen Virtual Storage 2network: eth0 Xen Virtual Ethernet Card 0 eth1 Xen Virtual Ethernet Card 1network interface: lo Loopback network interface eth0 Ethernet network interface
检查和收集Linux硬件信息的7个命令(4)
2014-05-2321:48|来源:本站搜集整理|作者:dnzg|点击:1922次
eth1Ethernetnetworkinterface
disk:
/dev/xvdaDisk
/dev/xvdbDisk
partition:
/dev/xvda1Partition
/dev/xvdb1Partition
cdrom:
/dev

0QEMUDVD-ROM
usbcontroller:
QumranetQemuvirtualmachine
bios:
BIOS
bridge:
QumranetQemuvirtualmachine
QumranetQemuvirtualmachine
QumranetQemuvirtualmachine
hub:
Linux2.6.32-279.el6.x86_64uhci_hcdUHCIHostController
memory:
MainMemory
unknown:
FPU
DMAcontroller
PIC
Timer
Keyboardcontroller
XenSourceXenPlatformDevice
[root@devopstmp]#
4.lspci
lsppci命令可列出PCI总线的信息以及连接到PCI总线上的设备信息,比如VGA适配器、SATA控制器、其他模块等等。lspci工具是pciutils包的一部分,所以在安装lspci之前,你需要安装pciutils包。
安装pciutils包使用下面的命令:
#yuminstallpciutils
[root@devopstmp]#yuminstallpciutils
Loadedplugins:fastestmirror
Loadingmirrorspeedsfromcachedhostfile
*base:mirrors.aliyun.com
*extras:mirrors.aliyun.com
*updates:mirrors.aliyun.com
SettingupInstallProcess
ResolvingDependencies
–>Runningtransactioncheck
—>Packagepciutils.x86_640:3.1.10-2.el6willbeinstalled
–>ProcessingDependency:pciutils-libs=3.1.10-2.el6forpackage:pciutils-3.1.10-2.el6.x86_64
–>Runningtransactioncheck
—>Packagepciutils-libs.x86_640:3.1.4-11.el6willbeupdated
—>Packagepciutils-libs.x86_640:3.1.10-2.el6willbeanupdate
–>FinishedDependencyResolution
DependenciesResolved
Installing:
pciutilsx86_643.1.10-2.el6
85k
Updatingfordependencies:
pciutils-libsx86_643.1.10-2.el6
34 k….. Dependency Updated: pciutils-libs.x86_64 0:3.1.10-2.el6 Complete!示例:[root@devops tmp]# lspci 00:00.0 Host bridge: Intel Corporation 440FX – 82441FX PMC [Natoma] (rev 02)00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)00:02.0 VGA compatible controller: Cirrus Logic GD 544600:03.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)[root@devops tmp]#5. lsusb-列出USB总线信息这个命令可列出USB控制器的设备信息。lsusb工具是usbutils包的一部分,所以你需要按照如下命令安装:#yum install usbutils[root@devops tmp]# yum install usbutilsLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.comSetting up Install ProcessResolving Dependencies–> Running transaction check—> Package usbutils.x86_64 0:003-4.el6 will be installed–> Processing Dependency: libusb-1.0.so.0()(64bit) for package: usbutils-003-4.el6.x86_64–> Running transaction check—> Package libusb1.x86_64 0:1.0.9-0.6.rc1.el6 will be installed–> Finished Dependency ResolutionDependencies Resolved============================================Package Arch Version Size=======================================================Installing:usbutils x86_64 003-4.el6 71 kInstalling for dependencies:libusb1 x86_64 1.0.9-0.6.rc1.el6 80 kTransaction Summary================================================================Install 2 Package(s)Total download size: 152 kInstalled size: 377 kIs this ok [y/N]: yDownloading Packages:(1/2): libusb1-1.0.9-0.6.rc1.el6.x86_64.rpm 00:00 (2/2): usbutils-003-4.el6.x86_64.rpm

00:00
——————————————————–
Total
00:00
Runningrpm_check_debug
RunningTransactionTest
TransactionTestSucceeded
RunningTransaction
Installing:libusb1-1.0.9-0.6.rc1.el6.x86_64
1/2
Installing:usbutils-003-4.el6.x86_64
2/2
Verifying:usbutils-003-4.el6.x86_64
1/2
Verifying:libusb1-1.0.9-0.6.rc1.el6.x86_64
2/2
Installed:
usbutils.x86_640:003-4.el6
DependencyInstalled:
libusb1.x86_640:1.0.9-0.6.rc1.el6
Complete!
示例:
[root@devopstmp]#lsusb
Bus001Device001:ID1d6b:0001LinuxFoundation1.1roothub
Bus001Device002:ID0627:0001AdomaxTechnologyCo.,Ltd
[root@devopstmp]#
6.lsblk-列出块设备的信息
[root@devopstmp]#lsblk
NAMEMAJ:MINRMSIZEROTYPEMOUNTPOINT
xvda202:0020G0disk
└─xvda1202:1020G0part/
xvdb202:16010G0disk
└─xvdb1202:17010G0part/alidata
sr011:01362K0rom
7.lsscsi-列出SCSI的设备信息
列出SCSI/SDAT设备的信息,比如硬盘驱动器、光盘驱动器。
[root@devopstmp]#lsscsi
[1:0:0:0]cd/dvdQEMUQEMUDVD-ROM0.10/dev

0
[root@devops tmp]#完毕!Enjoy this! 

  
以上就是橙子系统给大家介绍的如何使的方法都有一定的了解了吧,好了,如果大家还想了解更多的资讯,那就赶紧点击橙子系统官网吧。

本文来自橙子系统http://www.czgho.com/如需转载请注明!推荐:win7纯净版

© 版权声明
THE END
喜欢就支持一下吧
点赞21 分享