在Linu系统中收集硬件和系统信息

显示硬件信息

Dmidecode

Dmidecode 可以读取硬件信息, 直接输入 sudo dmidecode 会输出大量信息, 可以按照下面的表格分类显示

# 显示BIOS信息sudo dmidecode -t 0

支持的类型

Type | Descritpion---- | --------------------------0    | BIOS1    | System2    | Base Board3    | Chassis4    | Processor5    | Memory Controller6    | Memory Module7    | Cache8    | Port Connector9    | System Slots10   | On Board Devices11   | OEM Strings12   | System Configuration Options13   | BIOS Language14   | Group Associations15   | System Event Log16   | Physical Memory Array17   | Memory Device18   | 32-bit Memory Error19   | Memory Array Mapped Address20   | Memory Device Mapped Address21   | Built-in Pointing Device22   | Portable Battery23   | System Reset24   | Hardware Security25   | System Power Controls26   | Voltage Probe27   | Cooling Device28   | Temperature Probe29   | Electrical Current Probe30   | Out-of-band Remote Access31   | Boot Integrity Services32   | System Boot33   | 64-bit Memory Error34   | Management Device35   | Management Device Component36   | Management Device Threshold Data37   | Memory Channel38   | IPMI Device39   | Power Supply

lshw

lshw(Hardware Lister)是另外一个可以查看硬件信息的工具, 不仅如此, 它还可以用来做一些硬件的benchmark. 这个工具其实就是用/proc里面读取一些文件来显示相关的信息, 它用到了如下文件和目录:

Path
Description

/proc/cpuinfo
显示CPU信息

/proc/bus/pci
显示pci信息

/proc/scsi
显示scsi信息

/proc/net/dev
显示网络设备信息

/proc/kcore
从内存映像读取相关信息

/proc/ide
显示IDE设备信息

/proc/devices
其他设备

/proc/mounts
当前挂载信息

/proc/fstab
启动时的挂载点

显示帮助

ubuntu@ubuntu:~$ sudo lshw -hHardware Lister (lshw) - B.02.16usage: lshw [-format] [-options ...]       lshw -version    -version        print program version (B.02.16)format can be    -html           output hardware tree as HTML    -xml            output hardware tree as XML    -short          output hardware paths    -businfo        output bus informationoptions can be    -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.)    -numeric        output numeric IDs (for PCI, USB, etc.)

显示总线信息

ubuntu@ubuntu:~$ sudo lshw -businfoBus info          Device     Class          Description=======================================================                             system         B85M-D2V (To be filled by O.E.M.)                             bus            B85M-D2V                             memory         64KiB BIOS                             memory         256KiB L1 cache                             memory         1MiB L2 cache                             memory         6MiB L3 cache                             memory         16GiB System Memory.........                  scsi0      storage        scsi@0:0.0.0      /dev/sda   disk           120GB KINGSTON SV300S3scsi@0:0.0.0,1    /dev/sda1  volume         95GiB EXT4 volumescsi@0:0.0.0,2    /dev/sda2  volume         15GiB Extended partition.........
# 显示简短的硬件摘要ubuntu@ubuntu:~$ sudo lshw -shortH/W path        Device     Class          Description=====================================================........./0/1/0.0.0      /dev/sda   disk           120GB KINGSTON SV300S3/0/1/0.0.0/1    /dev/sda1  volume         95GiB EXT4 volume/0/1/0.0.0/2    /dev/sda2  volume         15GiB Extended partition/0/1/0.0.0/2/5  /dev/sda5  volume         15GiB Linux swap / Solaris partition.........

LS系列命令

CPU 信息

ubuntu@ubuntu:~$ 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:                 60Stepping:              3CPU MHz:               842.691BogoMIPS:              6185.68Virtualization:        VT-xL1d cache:             32KL1i cache:             32KL2 cache:              256KL3 cache:              6144KNUMA node0 CPU(s):     0-3

块设备信息

ubuntu@ubuntu:~$ lsblk NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTsda      8:0    0 111.8G  0 disk |-sda1   8:1    0  95.9G  0 part /|-sda2   8:2    0     1K  0 part `-sda5   8:5    0  15.9G  0 part [SWAP]sdb      8:16   0 465.8G  0 disk |-sdb1   8:17   0    50G  0 part |-sdb2   8:18   0     1K  0 part |-sdb5   8:21   0   139G  0 part |-sdb6   8:22   0   139G  0 part `-sdb7   8:23   0 137.7G  0 part 

PCI设备

ubuntu@ubuntu:~$ lspci00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06).........

USB设备

ubuntu@ubuntu:~$ lsusbBus 004 Device 002: ID 8087:8000 Intel Corp. Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub.........

SCSI 磁盘信息

ubuntu@ubuntu:~$ lsscsi[0:0:0:0]    disk    ATA      KINGSTON SV300S3 BBF0  /dev/sda [1:0:0:0]    disk    ATA      ST500DM002-1BD14 KC48  /dev/sdb 

软件信息

Linux 分发信息

ubuntu@ubuntu:~$ lsb_release -aNo LSB modules are available.Distributor ID:    UbuntuDescription:    Ubuntu 14.04.4 LTSRelease:    14.04Codename:    trusty

内核版本信息

ubuntu@ubuntu:~$ uname -aLinux ubuntu 4.2.0-27-generic # 32~14.04.1-Ubuntu ...
ubuntu@ubuntu:~$ cat /proc/versionLinux version 4.2.0-27-generic (buildd@lcy01-23) ...

杀手级工具

apt-get install inxiinxi -Fx

inxi 还有很多参数组合可以用, 具体参考 inxi -h, 下面我举几个栗子:

显示分区的UUID

ubuntu@ubuntu:~$ inxi -pluPartition: ID: / size: 95G used: 1.4G (2%) fs: ext4 dev: /dev/sda1            label: N/A uuid:     -b3*a-4*04-b*c8-1b0cbf4a             ID: swap-1 size: 17.06GB used: 0.00GB (0%) fs: swap dev: /dev/sda5            label: N/A uuid:     -99*b-4*52-8*dd-85c181e9  

显示RAID阵列信息

ubuntu@ubuntu:~$ inxi -xx -RRAID:      System: supported: N/A           No RAID devices detected - /proc/mdstat and md_mod kernel raid module present           Unused Devices: none

磁盘序列号

inxi -xx -D

芯片供应商

inxi -xx -G

网络

inxi -xx -i

关键字:linux, hardware, 硬件, ubuntu

版权声明

本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处。如若内容有涉嫌抄袭侵权/违法违规/事实不符,请点击 举报 进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部