1. Windows下查看硬件信息
2. Linux系统查看硬件信息GUI
3. Linux命令行查看硬件设备
	3.1 查看PCI设备
	3.2 查看CPU
	3.3 查看内存
	3.4 查看显卡
	3.5 查看硬盘
	3.6 查看网络
	3.7 综合
	3.8 intel-gpu-tools

 

1. Windows下查看硬件信息

cpu-z 查看CPU,GPU,MB,RAM等主要部件。
https://www.cpuid.com/softwares.html

更加详细专业的有: AIDA64...
http://www.aida64.com/downloads/latesta64xe
安装后有1个月试用期。可以导出非常详细的系统信息,比如下面这样:
https://szosoft.blogspot.com/p/tom-pc2008.html

2. Linux系统查看硬件信息GUI

使用命令或快捷方式打开:
$ lstopo
打开后还有快捷键提示,如下图,可以看到2个硬盘分别接入那个地址,网卡使用那个PCI地址。


$ sudo hardinfo
可以看到硬件及操作系统软件的详细信息,如下图,可以看到这个x1的PCIe最大速率2.5GT/s


$ sudo lshw -X
打开若不显示任何内容,点一下Refresh刷新即可,如下图,可以看到USB的版本及速率


lshw的多种输出格式
$ lshw –help

 -html  	output hardware tree as HTML	将硬件树输出为HTML
 -xml   	output hardware tree as XML	将硬件树输出为XML
 -short 	output hardware paths   	输出硬件路径
 -businfo	output bus information  	输出总线信息
 -X     	use graphical interface 	使用图形界面

$ sudo lshw -html > lshw-html.html

3. Linux命令行查看硬件设备

3.1 查看PCI设备

$ lspci         	PCI设备列表,第一列就是设备的[ids]
$ lspci -tvnn   	PCI设备树状列表,可以看到PCIe端口被那些设备占用$ lspci -vvvnn -s [ids]	根据上面列表的[ids]查询详细信息
$ lsusb.py -i           	查看USB端口及设备,可以看到USB版本及速率,电流$ ls -l /dev/disk/by-path/	查看硬盘使用了那些端口

根据上面这些查询就能列出类似如下这张PCI设备的整体列表了

$ lspci 简述 $ lspci -tvnn $ lspci -vvvnn -s [ids] // 00:02.0
[ids] name Intel Corporation type 补充 树状显示 pin IRQ Kernel driver Kernel modules BridgeCtl:
00:00.0 Host bridge: Mobile PM965/GM965/GL960 Memory Controller Hub Host bridge         intel_agp  
00:02.0 VGA compatible controller: Mobile GM965/GL960 Integrated Graphics Controller (primary) VGA 板载显卡   A 16 i915 i915  
00:02.1 Display controller: Mobile GM965/GL960 Integrated Graphics Controller (secondary) Display              
00:19.0 Ethernet controller: 82562GT 10/100 Network Connection Ethernet 以太网卡   A 28 e1000e e1000e  
10:00.0 Network controller: PRO/Wireless 3945ABG [Golan] Network Connection Wireless 无线网卡 -- PCIe Port 2 A 30 iwl3945 iwl3945  
00:1b.0 Audio device: 82801H (ICH8 Family) HD Audio Controller Audio 声卡   A 29 snd_hda_intel snd_hda_intel  
00:1e.0 PCI bridge: 82801 Mobile PCI Bridge PCI bridge 02 --         Parity- SERR+ NoISA+ VGA- VGA16- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
00:1c.0 PCI bridge: 82801H (ICH8 Family) PCI Express Port 1 PCIe Port 1 bridge 08 -- A 24 pcieport  
00:1c.1 PCI bridge: 82801H (ICH8 Family) PCI Express Port 2 PCIe Port 2 bridge 10 Wireless B 25 pcieport  
00:1c.4 PCI bridge: 82801H (ICH8 Family) PCI Express Port 5 PCIe Port 5 bridge 28 USB3.0 A 26 pcieport  
00:1a.0 USB controller: 82801H (ICH8 Family) USB UHCI Controller #4 USB #4 usb3 A 16 uhci_hcd uhci_hcd  
00:1a.7 USB controller: 82801H (ICH8 Family) USB2 EHCI Controller #2 USB2 #2 usb1 C 18 ehci-pci ehci-pci  
00:1d.0 USB controller: 82801H (ICH8 Family) USB UHCI Controller #1 USB #1 usb4 A 20 uhci_hcd uhci_hcd  
00:1d.1 USB controller: 82801H (ICH8 Family) USB UHCI Controller #2 USB #2 usb5 B 21 uhci_hcd uhci_hcd  
00:1d.2 USB controller: 82801H (ICH8 Family) USB UHCI Controller #3 USB #3 usb6 C 18 uhci_hcd uhci_hcd  
00:1d.7 USB controller: 82801H (ICH8 Family) USB2 EHCI Controller #1 USB2 #1 usb2 SD A 20 ehci-pci ehci-pci  
28:00.0 USB controller: Renesas Technology Corp.
uPD720202 USB 3.0 Host Controller
USB 3.0 ExpressCard usb7,8 PCIe P5 A 16 xhci_hcd xhci_hcd  
00:1f.0 ISA bridge: 82801HM (ICH8M) LPC Interface Controller ISA bridge       lpc_ich lpc_ich  
00:1f.1 IDE interface: 82801HM/HEM (ICH8M/ICH8M-E) IDE Controller IDE HDD $ ls -l /dev/disk/by-path/ A 16 ata_piix ata_piix, pata_acpi, ata_generic  
00:1f.2 SATA controller: 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] SATA SSD B 27 ahci ahci  

3.2 查看CPU

$ cat /proc/cpuinfo | grep model\ name
model name: Intel(R) Core(TM)2 Duo CPU  T8300  @ 2.40GHz
model name: Intel(R) Core(TM)2 Duo CPU  T8300  @ 2.40GHz

3.3 查看内存

$ cat /proc/meminfo | grep MemTotal
MemTotal:        8146664 kB

3.4 查看显卡

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (primary) (rev 0c)
找到显卡的ids,再查看详细内容
$ lspci -vvvnn -s 00:02.0
查看详细内容,除了用上面的ids,也可以用简单的关键字VGA
$ lspci -vnn | grep VGA -A 12

$ sudo lshw -c video | grep configuration
       configuration: driver=i915 latency=0
       configuration: latency=0

使用 glxinfo 命令查看 OpenGL 的详细信息:
$ glxinfo |grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) 965GM
OpenGL version string: 2.1 Mesa 19.3.4
OpenGL shading language version string: 1.20
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 19.3.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16
OpenGL ES profile extensions:
$ pacman -Qo glxinfo
/usr/bin/glxinfo is owned by mesa-demos 8.4.0-2

  •   Arch 下安装 pacman S mesa-demos
  •   Ubuntu下安装 apt install mesa-utils

Mesa是一个开源的3D计算机图形库,它提供了一个通用的OpenGL实现,用于在多个平台上渲染三维图形。
http://www.mesa3d.org/

和GPU 相关的 Linux 命令

$ glxinfo | grep rendering	查看3D加速是否有效
$ glxgears -info        	Testing
$ nvidia-smi            	Nvidia自带一个命令行工具可以查看显存的使用情况
$ watch -n 10 nvidia-smi	周期性的输出显卡的使用情况,可以用watch指令实现
$ grep -i --color vga /var/log/Xorg.0.log

https://zhuanlan.zhihu.com/p/37640419

3.5 查看硬盘

$ lsblk -f
# blkid
df(disk free)
du(disk usage)

3.6 查看网络

ip, iw...
https://szosoft.blogspot.com/2020/02/ip-show.html
https://szosoft.blogspot.com/2020/03/busybox.html#205
https://www.cnblogs.com/sztom/articles/10764994.html

3.7 综合

设备\命令 $ lshw -c [class] # dmidecode -t [type] $ lspci -s [ids] $ cat /proc/ 更多命令
CPU processor processor - cpuinfo $ lscpu
内存 memory memory - meminfo $ lsmem
显卡 display, video - [ids]   $ lsgpu 
声卡 multimedia - [ids] ./asound/  
系统 system system      
总线 bus, bridge - [ids] ./bus/ $ lspci
网卡 network - [ids]    
存储 storage - [ids] ./scsi/ lsblk, blkid,
Du, df, fdisk
可用项: $ lshw -short 输错类型便会列出可用项 lspci 返回的第一列    

intel-gpu-tools

$ pacman -Qo intel-gpu-overlay
/usr/bin/intel-gpu-overlay is owned by intel-gpu-tools 1.25-1
直接运行,默认在屏幕左上角显示GPU的图形;
A. 总利用曲线;B. 软件分别占用曲线(当前的状态: chromium最低, xfwm4中等, vlc接近最高, Xorg最高);
有趣的是,通过快捷键调用截屏软件,发现这个区域始终在最高层,截图软件只能取到它背后的桌面... 

$ pacman -Qo intel_gpu_top
/usr/bin/intel_gpu_top is owned by intel-gpu-tools 1.25-1
直接运行,就在当前终端显示占用率。

$ lsgpu
sys:/sys/devices/pci0000:00/0000:00:02.0/drm/card0
    subsystem       : drm
    drm card        : /dev/dri/card0
    parent          : sys:/sys/devices/pci0000:00/0000:00:02.0

sys:/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128
    subsystem       : drm
    drm render      : /dev/dri/renderD128
    parent          : sys:/sys/devices/pci0000:00/0000:00:02.0

sys:/sys/devices/pci0000:00/0000:00:02.0
    subsystem       : pci
    drm card        : /dev/dri/card0
    drm render      : /dev/dri/renderD128
    vendor          : 8086
    device          : 2A02
$ gpu [Tab⇆]
intel-gpu-overlay    (Executable, 86kB)  intel_gpu_time  (Executable, 13kB)
intel_gpu_abrt      (Executable, 2.1kB)  intel_gpu_top   (Executable, 29kB)
intel_gpu_frequency  (Executable, 14kB)  lsgpu           (Executable, 13kB)
$ pacman -Qo lsgpu
/usr/bin/lsgpu is owned by intel-gpu-tools 1.25-1
$ pacman -Qi intel-gpu-tools
Name            : intel-gpu-tools
Version         : 1.25-1
Description     : Tools for development and testing of the Intel DRM driver
Architecture    : x86_64
URL             : https://gitlab.freedesktop.org/drm/igt-gpu-tools
Licenses        : MIT
Depends On      : libdrm  libpciaccess  cairo  python  xorg-xrandr  procps-ng
                  kmod  libxv  libunwind  peg  systemd
Installed Size  : 11.13 MiB
Packager        : Felix Yan <felixonmars@archlinux.org>
Build Date      : 2020-03-22T19:22:14 CST
Install Date    : 2020-03-24T08:19:48 CST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

通过Qi 选项查询intel-gpu-tools,这里看到安装原因是:Explicitly installed, 并不是其他包的需求。
实际是我执行每日更新时(# pacman -Syu),系统安装的。
正好在整理硬件查看软件,有lspci,lscpu,lsmem,lsblk,现在突然有了:lsgpu.
不过还有个小问题,在Linux下还是没有找到在哪里能清晰的看到板载显卡的显存支持多大,应用多大。