下面是Linux上检查硬件的命令列表。注意,不是所有的命令都可以在所有的发行版上使用。最好以root身份启动(或通过sudo)来获取所有信息。 lshw****
命令:lspci*
命令: lsusb
命令: dmidecode
而且,只是想补充一下我的两分钱,我也会尝试使用
hwinfo
,在使用完整的comand之前,你也许可以尝试一下简短的版本,
hwinfo --short
,它可能已经提供了你要找的信息。fll版本的细节非常丰富,所以最好用
hwinfo | more
sudo lshw -businfo
。lshw也有一个图形化的版本,叫做lsw-gtk:
Bus info Device Class Description
========================================================
system PORTEGE R930 (PT331E)
bus PORTEGE R930
memory 128KiB BIOS
memory 6GiB System Memory
memory 4GiB SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
memory 2GiB SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
cpu@0 processor Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
memory 32KiB L1 cache
memory 256KiB L2 cache
memory 4MiB L3 cache
memory 32KiB L1 cache
pci@0000:00:00.0 bridge 3rd Gen Core processor DRAM Controller
pci@0000:00:02.0 display 3rd Gen Core processor Graphics Controller
pci@0000:00:14.0 bus 7 Series/C210 Series Chipset Family USB xHCI Host Controller
pci@0000:00:16.0 communication 7 Series/C210 Series Chipset Family
MEI Controller #1
pci@0000:00:16.3 communication 7 Series/C210 Series Chipset Family KT Controller
pci@0000:00:19.0 eth0 network 82579LM Gigabit Network Connection
pci@0000:00:1a.0 bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
pci@0000:00:1b.0 multimedia 7 Series/C210 Series Chipset Family High Definition Audio Controller
pci@0000:00:1c.0 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 1
pci@0000:01:00.0 generic MMC/SD Host Controller
pci@0000:00:1c.1 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 2
pci@0000:00:1c.2 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 3
pci@0000:04:00.0 wlan0 network Centrino Advanced-N 6235
pci@0000:00:1c.5 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 6
pci@0000:00:1d.0 bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
pci@0000:00:1f.0 bridge QM77 Express Chipset LPC Controller
pci@0000:00:1f.2 storage 7 Series Chipset Family 6-port SATA Controller [AHCI mode]
scsi0 storage
scsi@0:0.0.0 /dev/sda disk 256GB TOSHIBA THNSNF25
scsi@0:0.0.0,1 /dev/sda1 volume 27GiB EXT4 volume
scsi@0:0.0.0,2 /dev/sda2 volume 210GiB Extended partition
/dev/sda5 volume 5722MiB Linux swap / Solaris partition
/dev/sda6 volume 204GiB Linux filesystem partition
scsi2 storage
scsi@2:0.0.0 /dev/cdrom disk DVD-RAM UJ8C2
power Lithium Ion Battery
power
wwan0 network Ethernet interface
sudo lshw-gtk &
根据你所使用的发行版的具体版本,这些命令可能需要安装(apt-get install, yum, pacman, . ..)
还有一个很流行的非标准脚本(需要安装),叫做screenFetch:
screenFetch是一个 “Bash截图信息工具"。这个方便的Bash脚本可以用来生成那些漂亮的终端主题信息+ASCII发行版图标。它将自动检测到你的发行版,并在右边显示ASCII版本的发行版标识和一些有价值的信息。它还可以指定不使用ASCII格式的图片、颜色、显示信息时的截图,甚至可以自定义截图命令。这个脚本非常容易添加,并且可以很容易扩展。
如果你使用puppet来管理你的基础设施,使用facter
facter processorcount sp_number_processors sp_current_processor_speed memorytotal operatingsystem osfamily operatingsystemrelease
processorcount => 4
sp_current_processor_speed => 2.5 GHz
sp_number_processors => 2
memorytotal => 8.00 GB
osfamily => RedHat
operatingsystem => CentOS
operatingsystemrelease => 6.5
你甚至可以输出为yaml或json
facter osfamily operatingsystem --json
{"osfamily":"Darwin","operatingsystem":"Darwin"}
facter osfamily operatingsystem --yaml
osfamily: Darwin
operatingsystem: Darwin
Chef有一个类似的工具叫ohai
如果你想知道很多关于通过PCI(或PCI-Express)总线连接到机器上的所有设备的信息,请输入lspci -vvknnqq
如果你想知道磁盘分区的信息,请输入sudo fdisk -l /dev/sda
你也可以使用dmidecode,它将提供系统的硬件组件的描述。
hw-probe](https://hub.docker.com/r/linuxhw/hw-probe/)工具一次性收集所有与硬件相关的列表器(hwinfo, lspci, lscpu, hdparm, smartctl, dmidecode等)的输出。