设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客

Linux硬件信息命令大全

2014-5-6 16:28| 发布者: 红黑魂| 查看: 3434| 评论: 0|来自: linux中国

摘要: 在linux系统中,有很多命令可以用于查询主机的硬件信息,有些命令仅仅针对于特定的硬件部件,比如cpu,内存等,而有些命令可以查询很多的硬件信息。这篇帖子简单地带大家了解一下最常用的查询各种硬件信息的命令,其 ...

硬件信息

在linux系统中,有很多命令可以用于查询主机的硬件信息,有些命令仅仅针对于特定的硬件部件,比如cpu,内存等,而有些命令可以查询很多的硬件信息。

这篇帖子简单地带大家了解一下最常用的查询各种硬件信息的命令,其中包括lscpu,hwinfo,lshw,dmidecode,lspci等等。

1. lscpu

lscpu命令可以用来查询处理器cpu的详细信息,只需要简单地输入lscpu即可,如下所示,它本身也没有提供更多选项和功能可供选择。

$ lscpuArchitecture:          x86_64CPU op-mode(s):        32-bit, 64-bitByte Order:            Little EndianCPU(s):                4On-line CPU(s) list:   0-3Thread(s) per core:    1Core(s) per socket:    4Socket(s):             1NUMA node(s):          1Vendor ID:             GenuineIntelCPU family:            6Model:                 23Stepping:              10CPU MHz:               1998.000BogoMIPS:              5302.48Virtualization:        VT-xL1d cache:             32KL1i cache:             32KL2 cache:              2048KNUMA node0 CPU(s):     0-3

2. lshw - 显示硬件信息列表

这个命令用途广泛,它可以根据你的需求以详细或概要的形式列出许多个不同硬件的参数信息,其中包括cpu,内存,磁盘,usb控制器,网卡等等,lshw实质上是从/proc文件目录下的不同文件中提取对应的硬件信息。

$ sudo lshw -shortH/W path        Device      Class       Description===================================================                        system      ()/0                          bus         DG35EC/0/0                        processor   Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz/0/0/1                      memory      2MiB L2 cache/0/0/3                      memory      32KiB L1 cache/0/2                        memory      32KiB L1 cache/0/4                        memory      64KiB BIOS/0/14                       memory      8GiB System Memory/0/14/0                     memory      2GiB DIMM DDR2 Synchronous 667 MHz (1.5 ns)/0/14/1                     memory      2GiB DIMM DDR2 Synchronous 667 MHz (1.5 ns)/0/14/2                     memory      2GiB DIMM DDR2 Synchronous 667 MHz (1.5 ns)/0/14/3                     memory      2GiB DIMM DDR2 Synchronous 667 MHz (1.5 ns)/0/100                      bridge      82G35 Express DRAM Controller/0/100/2                    display     82G35 Express Integrated Graphics Controller/0/100/2.1                  display     82G35 Express Integrated Graphics Controller/0/100/19       eth0        network     82566DC Gigabit Network Connection/0/100/1a                   bus         82801H (ICH8 Family) USB UHCI Controller #4/0/100/1a.1                 bus         82801H (ICH8 Family) USB UHCI Controller #5/0/100/1a.7                 bus         82801H (ICH8 Family) USB2 EHCI Controller #2/0/100/1b                   multimedia  82801H (ICH8 Family) HD Audio Controller/0/100/1c                   bridge      82801H (ICH8 Family) PCI Express Port 1/0/100/1c.1                 bridge      82801H (ICH8 Family) PCI Express Port 2/0/100/1c.2                 bridge      82801H (ICH8 Family) PCI Express Port 3/0/100/1c.2/0               storage     JMB368 IDE controller/0/100/1d                   bus         82801H (ICH8 Family) USB UHCI Controller #1/0/100/1d.1                 bus         82801H (ICH8 Family) USB UHCI Controller #2/0/100/1d.2                 bus         82801H (ICH8 Family) USB UHCI Controller #3/0/100/1d.7                 bus         82801H (ICH8 Family) USB2 EHCI Controller #1/0/100/1e                   bridge      82801 PCI Bridge/0/100/1e/5                 bus         FW322/323 [TrueFire] 1394a Controller/0/100/1f                   bridge      82801HB/HR (ICH8/R) LPC Interface Controller/0/100/1f.2                 storage     82801H (ICH8 Family) 4 port SATA Controller [IDE mode]/0/100/1f.3                 bus         82801H (ICH8 Family) SMBus Controller/0/100/1f.5                 storage     82801HR/HO/HH (ICH8R/DO/DH) 2 port SATA Controller [IDE m/0/1            scsi3       storage     /0/1/0.0.0      /dev/sda    disk        500GB ST3500418AS/0/1/0.0.0/1    /dev/sda1   volume      70GiB Windows NTFS volume/0/1/0.0.0/2    /dev/sda2   volume      395GiB Extended partition/0/1/0.0.0/2/5  /dev/sda5   volume      97GiB HPFS/NTFS partition/0/1/0.0.0/2/6  /dev/sda6   volume      97GiB Linux filesystem partition/0/1/0.0.0/2/7  /dev/sda7   volume      1952MiB Linux swap / Solaris partition/0/1/0.0.0/2/8  /dev/sda8   volume      198GiB Linux filesystem partition/0/3            scsi4       storage     /0/3/0.0.0      /dev/cdrom  disk        DVD RW DRU-190A

点击下面的帖子,可以对lshw有更多的了解。

在Linux上使用lshw命令获取硬件信息

3. hwinfo - Hardware Information

hwinfo同样是一个使用非常广泛的硬件信息查询命令,类似于lshw,它同样可以详细或概要地报告多个部件的硬件信息,但不同的是,它有时可以给出比lshw更多的信息。

$ hwinfo --shortcpu:                                                                                   Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2000 MHz                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2000 MHz                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2666 MHz                       Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz, 2666 MHzkeyboard:  /dev/input/event2    AT Translated Set 2 keyboardmouse:  /dev/input/mice      Microsoft Basic Optical Mouse v2.0graphics card:                       Intel 965G-1                       Intel 82G35 Express Integrated Graphics Controllersound:                       Intel 82801H (ICH8 Family) HD Audio Controllerstorage:                       Intel 82801H (ICH8 Family) 4 port SATA IDE Controller                       Intel 82801H (ICH8 Family) 2 port SATA IDE Controller                       JMicron JMB368 IDE controllernetwork:  eth0                 Intel 82566DC Gigabit Network Connectionnetwork interface:  eth0                 Ethernet network interface  lo                   Loopback network interfacedisk:  /dev/sda             ST3500418ASpartition:  /dev/sda1            Partition  /dev/sda2            Partition  /dev/sda5            Partition  /dev/sda6            Partition  /dev/sda7            Partition  /dev/sda8            Partitioncdrom:  /dev/sr0             SONY DVD RW DRU-190Ausb controller:                       Intel 82801H (ICH8 Family) USB UHCI Controller #4                       Intel 82801H (ICH8 Family) USB UHCI Controller #5                       Intel 82801H (ICH8 Family) USB2 EHCI Controller #2                       Intel 82801H (ICH8 Family) USB UHCI Controller #1                       Intel 82801H (ICH8 Family) USB UHCI Controller #2                       Intel 82801H (ICH8 Family) USB UHCI Controller #3                       Intel 82801H (ICH8 Family) USB2 EHCI Controller #1bios:                       BIOS... TRUNCATED ...

点击下面的链接可以查看更多关于hwinfo的信息。

在Linux上使用hwinfo命令获取硬件信息

4. lspci - 显示pci总线相关信息

lscpi命令可以列出pci总线上信息,以及所有连接到pci总线上的设备信息,比如VGA适配器,显卡,网卡,usb端口,sata控制器等等。

$ lspci00:00.0 Host bridge: Intel Corporation 82G35 Express DRAM Controller (rev 03)00:02.0 VGA compatible controller: Intel Corporation 82G35 Express Integrated Graphics Controller (rev 03)00:02.1 Display controller: Intel Corporation 82G35 Express Integrated Graphics Controller (rev 03)00:19.0 Ethernet controller: Intel Corporation 82566DC Gigabit Network Connection (rev 02)00:1a.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 02)00:1a.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 02)00:1a.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 02)00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 02)00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 02)00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 02)00:1c.2 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 3 (rev 02)00:1d.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 02)00:1d.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 02)00:1d.2 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 02)00:1d.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 02)00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev f2)00:1f.0 ISA bridge: Intel Corporation 82801HB/HR (ICH8/R) LPC Interface Controller (rev 02)00:1f.2 IDE interface: Intel Corporation 82801H (ICH8 Family) 4 port SATA Controller [IDE mode] (rev 02)00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 02)00:1f.5 IDE interface: Intel Corporation 82801HR/HO/HH (ICH8R/DO/DH) 2 port SATA Controller [IDE mode] (rev 02)03:00.0 IDE interface: JMicron Technology Corp. JMB368 IDE controller04:05.0 FireWire (IEEE 1394): LSI Corporation FW322/323 [TrueFire] 1394a Controller (rev 70)

可以使用grep命令筛选出特定的设备信息。

$ lspci -v | grep "VGA" -A 12

5. lsscsi - 列出scsi设备信息

列出scsi/sata设备信息,比如硬盘驱动器,光盘驱动器。

$ lsscsi[3:0:0:0]    disk    ATA      ST3500418AS      CC38  /dev/sda [4:0:0:0]    cd/dvd  SONY     DVD RW DRU-190A  1.63  /dev/sr0

6. lsusb - 列出usb总线信息,及设备信息

该命令可以显示USB控制器及连接到控制的设备信息。默认情况下,只显示概要信息,可以通过-v选项指示其显示更多的硬件信息。

$ lsusbBus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 005 Device 002: ID 045e:00cb Microsoft Corp. Basic Optical Mouse v2.0Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

上面信息显示,在该系统中,有一个usb端口正被鼠标占用。

7. Inxi

inxi命令是一个大的bash脚本文件,其通过从不同的信息来源和命令中获取硬件信息,最后能给出一个颜色高亮的,适合于非专业人员阅读的硬件信息报告。

$ inxi -Fx

8. lsblk - 列出块设备信息

列出所有块设备信息,其中包括硬盘分区信息,以及其他存储设备,如光盘,闪存等。

$ lsblkNAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTsda      8:0    0 465.8G  0 disk ├─sda1   8:1    0    70G  0 part ├─sda2   8:2    0     1K  0 part ├─sda5   8:5    0  97.7G  0 part /media/4668484A68483B47├─sda6   8:6    0  97.7G  0 part /├─sda7   8:7    0   1.9G  0 part [SWAP]└─sda8   8:8    0 198.5G  0 part /media/13f35f59-f023-4d98-b06f-9dfaebefd6c1sr0     11:0    1  1024M  0 rom

本文地址:http://linux.cn/article-2958-1.html

[ 欢迎转载,敬请在正文中标注并保留原文/译文链接和作者/译者等信息。 ]


酷毙

雷人
1

鲜花

鸡蛋

漂亮

刚表态过的朋友 (1 人)

  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部