作为一名程序员,对于电脑硬件的了解也是必不可少的。在CentOS7下查看显卡信息,对于我们调试程序、安装驱动等都是非常有帮助的。那么linux,今天我们就来探讨一下CentOS7下如何查看显卡信息。
一、通过lspci命令查看显卡信息
lspci是一个列出所有PCI总线设备的Linux命令。在终端输入以下命令即可查看显卡信息:
lspci | grep VGA
运行成功后,会输出类似以下的信息:
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07)
其中“VGA compatible controller”表示设备类型是显卡控制器。
二、通过hwinfo命令查看显卡信息
hwinfo是一个硬件信息查询工具红旗linux桌面版,可以用来查询硬件信息。在终端输入以下命令即可查看显卡信息:
hwinfo --gfxcard
运行成功后,会输出类似以下的信息:
22: PCI 02.0: 0300 VGA compatible controller (VGA) [Created at pci.386] Unique ID:_Znp.pDq8Xj+8Jz6 SysFS ID:/devices/pci0000:00/0000:00:02.0 SysFS BusID: 0000:00:02.0 Hardware Class:91dbaa78882738630c71959ded8838f2:"Intel HD Graphics 620" Vendor: pci 0x8086 "Intel Corporation" Device: pci 0x5916 "HD Graphics 620" SubVendor: pci 0x1028 "Dell" SubDevice: pci 0x079e Revision: 0x02 Driver:"i915"
三、通过lshw命令查看显卡信息
lshw是一个列出所有硬件信息的Linux命令。在终端输入以下命令即可查看显卡信息:
sudo lshw -C display
运行成功后,会输出类似以下的信息:
*-display description: VGA compatible controller product: HD Graphics 520 vendor: Intel Corporation physical id: 2 bus info: pci@0000:00:02.0 version: 07 width: 64 bits clock: 33MHz capabilities: msi pm vga_controller bus_master cap_list rom configuration: driver=i915 latency=0 resources: irq:129 memory:a1000000-a1ffffff memory:b0000000-bfffffff ioport:e000(size=64) memory:c0000-dffff
四、通过glxinfo命令查看显卡驱动信息
glxinfo是一个查询OpenGL相关信息的工具。在终端输入以下命令即可查看显卡驱动信息:
glxinfo | grep OpenGL
运行成功后,会输出类似以下的信息:
OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2) OpenGL core profile version string:4.5(Core Profile) Mesa 17.0.7 OpenGL core profile shading language version string:4.50 OpenGL core profile context flags:(none)350d314611a0d794851c50c4663f72ec: core profile OpenGL core profile extensions:
五、通过nvidia-smi命令查看NVIDIA显卡信息
如果你的电脑使用的是NVIDIA显卡,那么可以使用nvidia-smi命令来查看显卡信息。在终端输入以下命令即可查看显卡信息:
nvidia-smi -a
运行成功后,会输出类似以下的信息:
==============NVSMI LOG============== Timestamp : Fri Jun 4 10:24:36 2023 Driver Version : 418.56 CUDA Version : 10.1 Attached GPUs : 1 GPU 00000000:01:00.0 Product Name : GeForce GTX 1060 with Max-Q Design Product Brand : GeForce Display Mode : Disabled Persistence Mode : Enabled Accounting Mode : Disabled Accounting Mode Buffer Size : Driver Model
六、通过Xorg日志文件查看显卡信息
Xorg是Linux下常用的图形界面系统,它会记录一些系统和硬件信息到日志文件中。在终端输入以下命令即可查看显卡信息:
cat /var/log/Xorg.0.log | grep -i"VGA compatible"
运行成功后centos 查看显卡,会输出类似以下的信息:
[ 23.745](**)| |-->Device "VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07)" [ 23.794](II) intel(0): Output eDP1 has no monitor section
七、通过系统设置查看显卡信息
在CentOS7中,我们也可以通过系统设置来查看显卡信息。点击“应用程序”->“实用工具”->“设置”,然后选择“设备”->“显示”,即可查看显卡信息。
八、总结
通过以上八种方法,我们可以很轻松地在CentOS7下查看显卡信息。不同的方法适用于不同的场景,我们可以根据实际情况选择合适的方法。掌握这些方法centos 查看显卡,对于我们开发和调试程序都是非常有帮助的。