0 前言
在Linux中,获取cpu信息的命令很多,除了我们已经研究的 cat /proc/cpuinfo、lscpu、nproc命令,还有hwinfo --cpu 命令。
1 安装 hwinfo 命令
hwinfo是外部命令,有些系统中没有安装。那么我们可以使用命令:
sudo apt install hwinfo
来进行安装。
[purpleendurer @ bash ~] hwinfo --cpu
程序“hwinfo”尚未安装。 您可以使用以下命令安装:
sudo apt install hwinfo
[purpleendurer @ bash ~] sudo apt install hwinfo
[sudo] purpleendurer 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
gnome-video-effects gstreamer1.0-clutter-3.0 libcheese-gtk25 libcheese8 libclutter-gst-3.0-0 libclutter-gtk-1.0-0 libcompfaceg1 libetpan17 libfreerdp-cache1.1 libfreerdp-client1.1 libfreerdp-codec1.1
libfreerdp-common1.1.0 libfreerdp-core1.1 libfreerdp-crypto1.1 libfreerdp-gdi1.1 libfreerdp-locale1.1 libfreerdp-primitives1.1 libfreerdp-utils1.1 libgusb2 libnatpmp1 libpisock9 libssh-4 libudev-dev
libvncclient1 libwinpr-crt0.1 libwinpr-dsparse0.1 libwinpr-environment0.1 libwinpr-file0.1 libwinpr-handle0.1 libwinpr-heap0.1 libwinpr-input0.1 libwinpr-interlocked0.1 libwinpr-library0.1 libwinpr-path0.1
libwinpr-pool0.1 libwinpr-registry0.1 libwinpr-rpc0.1 libwinpr-sspi0.1 libwinpr-synch0.1 libwinpr-sysinfo0.1 libwinpr-thread0.1 libwinpr-utils0.1 libxcomp3 nxproxy remmina-common
使用'sudo apt autoremove'来卸载它(它们)。
将会同时安装下列软件:
libhd21
下列【新】软件包将被安装:
hwinfo libhd21
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 629 个软件包未被升级。
需要下载 578 kB 的归档。
解压缩后会消耗 2,588 kB 的额外空间。
您希望继续执行吗? [Y/n] y
获取:1 http://archive.kylinos.cn/kylin/KYLIN-ALL 10.0/universe arm64 libhd21 arm64 21.23-1kord [560 kB]
获取:2 http://archive.kylinos.cn/kylin/KYLIN-ALL 10.0/universe arm64 hwinfo arm64 21.23-1kord [17.7 kB]
已下载 578 kB,耗时 0秒 (622 kB/s)
正在选中未选择的软件包 libhd21:arm64。
(正在读取数据库 ... 系统当前共安装有 228925 个文件和目录。)
正准备解包 .../libhd21_21.23-1kord_arm64.deb ...
正在解包 libhd21:arm64 (21.23-1kord) ...
正在选中未选择的软件包 hwinfo。
正准备解包 .../hwinfo_21.23-1kord_arm64.deb ...
正在解包 hwinfo (21.23-1kord) ...
正在处理用于 libc-bin (2.23-0kord11k20.5) 的触发器 ...
正在处理用于 man-db (2.7.5-1kord) 的触发器 ...
正在设置 libhd21:arm64 (21.23-1kord) ...
正在设置 hwinfo (21.23-1kord) ...
正在处理用于 libc-bin (2.23-0kord11k20.5) 的触发器 ...
[purpleendurer @ bash ~] type -a hwinfo
hwinfo 是 /usr/sbin/hwinfo
安装过程:
hwinfo是外部命令
2 hwinfo 命令的功能
hwinfo命令来自英文“Hardware Information”的缩写,它的功能是用于查询硬件信息。
我们可以指定不同的选项来查询不同的硬件信息。
[purpleendurer @ bash ~] hwinfo --help
Usage: hwinfo [OPTIONS]
Probe for hardware.
Options:
--<HARDWARE_ITEM>
This option can be given more than once. Probe for a particular
HARDWARE_ITEM. Available hardware items are:
all, arch, bios, block, bluetooth, braille, bridge, camera,
cdrom, chipcard, cpu, disk, dsl, dvb, fingerprint, floppy,
framebuffer, gfxcard, hub, ide, isapnp, isdn, joystick, keyboard,
memory, modem, monitor, mouse, netcard, network, partition,
pci, pcmcia, pcmcia-ctrl, pppoe, printer, redasd,
reallyall, scanner, scsi, smp, sound, storage-ctrl, sys, tape,
tv, uml, usb, usb-ctrl, vbe, wlan, xen, zip
--short
Show only a summary. Use this option in addition to a hardware
probing option.
--listmd
Normally hwinfo does not report RAID devices. Add this option to
see them.
--only DEVNAME
This option can be given more than once. If you add this option,
only data about devices with DEVNAME will be shown.
--save-config SPEC
Store config for a particular device below /var/lib/hardware.
SPEC can be a device name, an UDI, or 'all'. This option must be
given in addition to a hardware probing option.
--show-config UDI
Show saved config data for a particular device.
--map
If disk names have changed (e.g. after a kernel update) this
prints a list of disk name mappings. Note that you must have
used --save-config at some point before for this can work.
--debug N
Set debug level to N. The debug info is shown only in the log
file. If you specify a log file, the debug level is implicitly
set to a reasonable value.
--verbose
Increase verbosity. Only together with --map.
--log FILE
Write log info to FILE.
--dump-db N
Dump hardware data base. N is either 0 for the external data
base in /var/lib/hardware, or 1 for the internal data base.
--version
Print libhd version.
--help
Print usage.
[purpleendurer @ bash ~]
hwinfo命令可以查询的硬件信息包括:
设备项 | 说明 |
---|---|
all | 以下所有信息 |
arch | 系统架构信息 |
bios | BIOS 信息 |
block | |
bluetooth | 蓝牙信息 |
braille | |
bridge | |
camera | 摄像头信息 |
cdrom | 光驱信息 |
chipcard | 芯片信息 |
cpu | CPU信息 |
disk | 磁盘信息 |
dsl | |
dvb | |
fingerprint | |
floppy | 软驱信息 |
framebuffer | |
gfxcard | |
hub | 总线信息 |
ide | IDE设备信息 |
isapnp | |
isdn | |
joystick | |
keyboard | 键盘信息 |
memory | 内存信息 |
modem | 调制解调器信息 |
monitor | 显示器信息 |
mouse | 鼠标信息 |
netcard | 网卡信息 |
network | 网络信息 |
partition | |
pci | PCI设备信息 |
pcmcia | |
pcmcia-ctrl | |
pppoe | |
printer | 打印机信息 |
redasd | |
reallyall | |
scanner | 扫描仪信息 |
scsi | scsi设备信息 |
smp | |
sound | |
storage | 储存器信息 |
storage-ctrl | 储存控制器信息 |
sys | |
tape | |
tv | |
uml | |
usb | USB设备信息 |
usb-ctrl | USB控制器信息 |
vbe | |
wlan | WLAN信息 |
xen | |
zip |
3 hwinfo --cpu 命令的功能
如果我们在使用hwinfo命令时指定--cpu 选项,就可以查询cpu设备信息。
4 hwinfo --cpu 命令显示的信息
[purpleendurer @ bash ~] hwinfo --cpu
01: None 00.0: 10103 CPU
[Created at cpu.338]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: AArch64
Vendor: "unknown (70)"
Model: 1.3.0 ""
Features: fp,asimd,evtstrm,aes,pmull,sha1,sha2,crc32
Config Status: cfg=new, avail=yes, need=no, active=unknown
02: None 00.0: 10103 CPU
[Created at cpu.338]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: AArch64
Vendor: "unknown (70)"
Model: 1.3.0 ""
Features: fp,asimd,evtstrm,aes,pmull,sha1,sha2,crc32
Config Status: cfg=new, avail=yes, need=no, active=unknown
03: None 00.0: 10103 CPU
[Created at cpu.338]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: AArch64
Vendor: "unknown (70)"
Model: 1.3.0 ""
Features: fp,asimd,evtstrm,aes,pmull,sha1,sha2,crc32
Config Status: cfg=new, avail=yes, need=no, active=unknown
04: None 00.0: 10103 CPU
[Created at cpu.338]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: AArch64
Vendor: "unknown (70)"
Model: 1.3.0 ""
Features: fp,asimd,evtstrm,aes,pmull,sha1,sha2,crc32
Config Status: cfg=new, avail=yes, need=no, active=unknown
返回信息说明
返回信息 | 说明 |
---|---|
Unique ID: rdCR.j8NaKXDZtZ6 | 唯一ID |
Hardware Class: cpu | 硬件类别 |
Arch: AArch64 | 架构 |
Vendor: "unknown (70)" | 供应商 |
Model: 1.3.0 "" | 型号 |
Features: fp,asimd,evtstrm,aes,pmull,sha1,sha2,crc32 | 特性 |
Config Status: cfg=new, avail=yes, need=no, active=unknown | 配置状态 |