萌萌妈妈 发表于 2015-1-15 22:13:52

Linux教程之反省和搜集 Linux 硬件信息的 7 个命令

安装和登录命令:login、shutdown、halt、reboot、mount、umount、chsh
  在Linux体系中,有很多命令可用于查询主机的硬件信息。一些命令只针对特定的硬件组件,好比CPU、内存,一些命令能够查询多个硬件信息。
  这篇文章只是复杂的让每一个人懂得查询硬件信息的基础命令利用,包含lscpu、hwinfo、lshw、lspci、lsblk、lsusb等等。



  1.lscpu用于查询CPU信息

#lscpuArchitecture:x86_64CPUop-mode(s):32-bit,64-bitByteOrder:LittleEndianCPU(s):1On-lineCPU(s)list:0Thread(s)percore:1Core(s)persocket:1CPUsocket(s):1NUMAnode(s):1VendorID:GenuineIntelCPUfamily:6Model:45Stepping:7CPUMHz:2194.842BogoMIPS:4389.68Hypervisorvendor:XenVirtualizationtype:fullL1dcache:32KL1icache:32KL2cache:256KL3cache:15360KNUMAnode0CPU(s):0  2.lshw显现硬件信息表

  这个命令使用广泛,它可经由过程团体需求而列出多种分歧的硬件参数:CPU、内存、硬盘、USB把持器、lshw卡片等等,实质上就是从/proc目次分歧文件中中提取对应的硬件信息。
  依照上面的步骤往安装lshw工具,然后就能够利用了。
wgethttp://ezix.org/software/files/lshw-B.02.14.tar.gztar-zxvflshw-B.02.14.tar.gzcdlshw-B.02.14make&&makeinstall  示例:
#lshw-shortH/WpathDeviceClassDescription=====================================================systemHVMdomU/0busMotherboard/0/0memory96KiBBIOS/0/1processorIntel(R)Xeon(R)CPUE5-24300@2.20GHz/0/2memorySystemMemory/0/2/0memory512MiBDIMMRAM/0/2/1memory512MiBDIMMRAM/0/3memory96KiBBIOS/0/4processorCPU/0/5memorySystemMemory/0/6memory/0/7memory/0/100bridge440FX-82441FXPMC/0/100/1bridge82371SBPIIX3ISA/0/100/1.1scsi1storage82371SBPIIX3IDE/0/100/1.1/0.0.0/dev/cdrom1diskSCSICD-ROM/0/100/1.2bus82371SBPIIX3USB/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#  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#rpm-Uvhhttp://mirror.symnds.com/distributions/gf/el/6/gf/x86_64/gf-release-6-6.gf.el6.noarch.rpmRetrievinghttp://mirror.symnds.com/distributions/gf/el/6/gf/x86_64/gf-release-6-6.gf.el6.noarch.rpmwarning:/var/tmp/rpm-tmp.m2mMAO:HeaderV4RSA/SHA1Signature,keyID13a4d2a9:NOKEYPreparing...###########################################1:gf-release############################################yumlisthwinfoLoadedplugins:fastestmirrorLoadingmirrorspeedsfromcachedhostfile*base:mirrors.aliyun.com*extras:mirrors.aliyun.com*updates:mirrors.aliyun.comgf00:00gf/primary_db00:00AvailablePackageshwinfo.x86_64#yumlisthwinfoLoadedplugins:fastestmirrorLoadingmirrorspeedsfromcachedhostfile*base:mirrors.aliyun.com*extras:mirrors.aliyun.com*updates:mirrors.aliyun.comgf00:00gf/primary_db00:00AvailablePackageshwinfo.x86_6420.2-1.gf.el6#yuminstallhwinfoLoadedplugins:fastestmirrorLoadingmirrorspeedsfromcachedhostfile*base:mirrors.aliyun.com*extras:mirrors.aliyun.com*updates:mirrors.aliyun.comSettingupInstallProcessResolvingDependencies-->Runningtransactioncheck--->Packagehwinfo.x86_640:20.2-1.gf.el6willbeinstalled.....  示例:
#hwinfo-shortoops:dontknowwhattodowith"short"#hwinfo--shortcpu:Intel(R)Xeon(R)CPUE5-24300@2.20GHz,2194MHzkeyboard:/dev/input/event3ATTranslatedSet2keyboard/dev/ttyS0serialconsolemouse:/dev/input/miceAdomaxQEMUUSBTablet/dev/input/miceMacintoshmousebuttonemulation/dev/input/miceImExPS/2GenericExplorerMousegraphicscard:CirrusLogicGD5446storage:Intel82371SBPIIX3IDEXenVirtualStorage0XenVirtualStorage1XenVirtualStorage2network:eth0XenVirtualEthernetCard0eth1XenVirtualEthernetCard1networkinterface:loLoopbacknetworkinterfaceeth0Ethernetnetworkinterfaceeth1Ethernetnetworkinterfacedisk:/dev/xvdaDisk/dev/xvdbDiskpartition:/dev/xvda1Partition/dev/xvdb1Partitioncdrom:/dev/sr0QEMUDVD-ROMusbcontroller:QumranetQemuvirtualmachinebios:BIOSbridge:QumranetQemuvirtualmachineQumranetQemuvirtualmachineQumranetQemuvirtualmachinehub:Linux2.6.32-279.el6.x86_64uhci_hcdUHCIHostControllermemory:MainMemoryunknown:FPUDMAcontrollerPICTimerKeyboardcontrollerXenSourceXenPlatformDevice#  4.lspci

  lsppci命令可列出PCI总线的信息和毗连到PCI总线上的设备信息,好比VGA适配器、SATA把持器、其他模块等等。lspci工具是pciutils包的一部分,以是在安装lspci之前,你必要安装pciutils包。
  安装pciutils包利用上面的命令:
#yuminstallpciutils#yuminstallpciutilsLoadedplugins:fastestmirrorLoadingmirrorspeedsfromcachedhostfile*base:mirrors.aliyun.com*extras:mirrors.aliyun.com*updates:mirrors.aliyun.comSettingupInstallProcessResolvingDependencies-->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-->FinishedDependencyResolutionDependenciesResolvedInstalling:pciutilsx86_643.1.10-2.el685kUpdatingfordependencies:pciutils-libsx86_643.1.10-2.el634k.....DependencyUpdated:pciutils-libs.x86_640:3.1.10-2.el6Complete!  示例:
wgethttp://ezix.org/software/files/lshw-B.02.14.tar.gztar-zxvflshw-B.02.14.tar.gzcdlshw-B.02.14make&&makeinstall0  5.lsusb-列出USB总线信息

  这个命令可列出USB把持器的设备信息。
  lsusb工具是usbutils包的一部分,以是你必要依照以下命令安装:
wgethttp://ezix.org/software/files/lshw-B.02.14.tar.gztar-zxvflshw-B.02.14.tar.gzcdlshw-B.02.14make&&makeinstall1wgethttp://ezix.org/software/files/lshw-B.02.14.tar.gztar-zxvflshw-B.02.14.tar.gzcdlshw-B.02.14make&&makeinstall2  示例:
wgethttp://ezix.org/software/files/lshw-B.02.14.tar.gztar-zxvflshw-B.02.14.tar.gzcdlshw-B.02.14make&&makeinstall3  6.lsblk-列出块设备的信息

wgethttp://ezix.org/software/files/lshw-B.02.14.tar.gztar-zxvflshw-B.02.14.tar.gzcdlshw-B.02.14make&&makeinstall4  7.lsscsi-列出SCSI的设备信息

  列出SCSI/SDAT设备的信息,好比硬盘驱动器、光盘驱动器。
wgethttp://ezix.org/software/files/lshw-B.02.14.tar.gztar-zxvflshw-B.02.14.tar.gzcdlshw-B.02.14make&&makeinstall5  终了!Enjoythis!
  原文地点:http://www.itsprite.com/linux-7-linux-commands-to-checkgather-hardware-information-in-linux-system/
看不懂man文档的人.在linux中,命令可分为系统基本命令和应用程序命令.系统基本命令是所有的unix类系统都支持的命令,走到哪都不变,只要是unix类系统上就肯定有.

灵魂腐蚀 发表于 2015-1-17 17:10:26

请问谁有Linux的学习心得的吗?简单的说说?

再见西城 发表于 2015-1-17 17:10:26

有疑问前,知识学习前,先用搜索。

小女巫 发表于 2015-1-22 06:35:13

把这个问题放在其他Linux社区请求帮助也是一种选择。如果Linux得不到答案,请不要以为我们觉得无法帮助你。有时只是看到你问题的人不知道答案罢了。这时换一个社区是不错的选择。

分手快乐 发表于 2015-1-30 23:33:26

学习Linux应具备的。[书籍+网络资源]

深爱那片海 发表于 2015-2-6 17:16:36

当然你不需搭建所有服务,可以慢慢来。自己多动手,不要非等着别人帮你解决问题。

仓酷云 发表于 2015-2-17 19:47:39

Linux高手更具有鼓励新手的文化精神。如何在Linux社区获得帮助,需要说明的是你要有周全的思考,准备好你的问题,不要草率的发问。

柔情似水 发表于 2015-3-5 22:57:03

直到学习Linux这门课以后,我才知道,原来我错了。?

因胸联盟 发表于 2015-3-20 00:41:42

在学习的过程中,我们用的是VM虚拟机,开始时真的不真的该怎么去做,特别是我的是命令窗口界面,别人的是图形界面,我都不知道怎么调过来。
页: [1]
查看完整版本: Linux教程之反省和搜集 Linux 硬件信息的 7 个命令