Linux shell编程学习笔记57:lshw命令 获取cpu设备信息

0 前言

在Linux中,获取cpu信息的命令很多,除了我们已经研究的 cat /proc/cpuinfo、lscpu、nproc、hwinfo --cpu 命令,还有 lshw命令。

1 lshw命令的功能

 lshw命令源自英文list hardware,即列出系统的硬件信息,这些硬件包括cpu、内存、硬盘、pci设备等等。今天我们主要是使用 lshw命令查询cpu信息。

[purpleendurer @ bash ~ ]lshw --help
Hardware Lister (lshw) - B.02.17
usage: lshw [-format] [-options ...]lshw -version-version        print program version (B.02.17)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.)[purpleendurer @ bash ~ ]

2 使用lshw命令查询cpu信息

2.1 lshw -C cpu:查询cpu信息

[purpleendurer @ bash ~ ]lshw -C cpu
WARNING: you should run this program as super-user.*-cpu:0                 physical id: 7bus info: cpu@0size: 2600MHzcapacity: 2600MHzcapabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpufreq*-cpu:1physical id: 8bus info: cpu@1size: 2600MHzcapacity: 2600MHzcapabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpufreq*-cpu:2physical id: 9bus info: cpu@2size: 2600MHzcapacity: 2600MHzcapabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpufreq*-cpu:3physical id: abus info: cpu@3size: 2600MHzcapacity: 2600MHzcapabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpufreq
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
[purpleendurer @ bash ~ ]

 

这是关于某个 CPU 的信息。具体含义如下:

序号信息含义
1-cpu:0CPU编号:表示这是第一个 CPU
2physical id: 7物理 ID是 7
3bus info: cpu@0总线信息
4size: 2600MHz尺寸是 2600MHz,即主频为 2.6GHz
5capacity: 2600MHz容量也是 2600MHz,即主频为 2.6GHz
6capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpufreq功能:包括 fp(浮点运算)、asimd(SIMD指令集)、evtstrm(事件跟踪)、aes(AES加密指令集)、pmull(多项式乘法)、sha1(SHA-1散列函数加速)、sha2(SHA-2散列函数加速)、crc32(CRC32校验)、cpufreq(CPU频率调节)

2.2 lshw -C cpu -short:查询和显示简短cpu信息

[purpleendurer @ bash ~ ]lshw -C cpu -short
WARNING: you should run this program as super-user.
H/W path    Device      Class      Description
==============================================
/0/7                    processor  
/0/8                    processor  
/0/9                    processor  
/0/a                    processor  
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
[purpleendurer @ bash ~ ]

2.3 lshw -C cpu -short:查询并以xml格式显示cpu信息

[purpleendurer @ bash ~ ]lshw -C cpu -xml
WARNING: you should run this program as super-user.
<?xml version="1.0" standalone="yes" ?>
<!-- generated by lshw-B.02.17 -->
<!-- GCC 5.4.0 20160609 -->
<!-- Linux 4.4.131-20200710.kylin.desktop-generic #kylin SMP Fri Jul 10 13:46:24 CST 2020 aarch64 -->
<!-- GNU libc 2 (glibc 2.23) -->
<!-- WARNING: not running as root -->
<list><node id="cpu:0" claimed="true" class="processor" handle=""><physid>7</physid><businfo>cpu@0</businfo><size units="Hz">2600000000</size><capacity units="Hz">2600000000</capacity><capabilities><capability id="fp" >Floating point instructions</capability><capability id="asimd" >Advanced SIMD</capability><capability id="evtstrm" >Event stream</capability><capability id="aes" >AES instructions</capability><capability id="pmull" >PMULL instruction</capability><capability id="sha1" >SHA1 instructions</capability><capability id="sha2" >SHA2 instructions</capability><capability id="crc32" >CRC extension</capability><capability id="cpufreq" >CPU Frequency scaling</capability></capabilities></node><node id="cpu:1" claimed="true" class="processor" handle=""><physid>8</physid><businfo>cpu@1</businfo><size units="Hz">2600000000</size><capacity units="Hz">2600000000</capacity><capabilities><capability id="fp" >Floating point instructions</capability><capability id="asimd" >Advanced SIMD</capability><capability id="evtstrm" >Event stream</capability><capability id="aes" >AES instructions</capability><capability id="pmull" >PMULL instruction</capability><capability id="sha1" >SHA1 instructions</capability><capability id="sha2" >SHA2 instructions</capability><capability id="crc32" >CRC extension</capability><capability id="cpufreq" >CPU Frequency scaling</capability></capabilities></node><node id="cpu:2" claimed="true" class="processor" handle=""><physid>9</physid><businfo>cpu@2</businfo><size units="Hz">2600000000</size><capacity units="Hz">2600000000</capacity><capabilities><capability id="fp" >Floating point instructions</capability><capability id="asimd" >Advanced SIMD</capability><capability id="evtstrm" >Event stream</capability><capability id="aes" >AES instructions</capability><capability id="pmull" >PMULL instruction</capability><capability id="sha1" >SHA1 instructions</capability><capability id="sha2" >SHA2 instructions</capability><capability id="crc32" >CRC extension</capability><capability id="cpufreq" >CPU Frequency scaling</capability></capabilities></node><node id="cpu:3" claimed="true" class="processor" handle=""><physid>a</physid><businfo>cpu@3</businfo><size units="Hz">2600000000</size><capacity units="Hz">2600000000</capacity><capabilities><capability id="fp" >Floating point instructions</capability><capability id="asimd" >Advanced SIMD</capability><capability id="evtstrm" >Event stream</capability><capability id="aes" >AES instructions</capability><capability id="pmull" >PMULL instruction</capability><capability id="sha1" >SHA1 instructions</capability><capability id="sha2" >SHA2 instructions</capability><capability id="crc32" >CRC extension</capability><capability id="cpufreq" >CPU Frequency scaling</capability></capabilities></node>
</list>
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
[purpleendurer @ bash ~ ]

 

2.4 lshw -C cpu -html:查询并以htm格式显示cpu信息

[purpleendurer @ bash ~ ]lshw -C cpu -html
WARNING: you should run this program as super-user.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator"  content="lshw-B.02.17" />
<style type="text/css">.first {font-weight: bold; margin-left: none; padding-right: 1em;vertical-align: top; }.second {padding-left: 1em; width: 100%; vertical-align: center; }.id {font-family: monospace;}.indented {margin-left: 2em; border-left: dotted thin #dde; padding-bottom: 1em; }.node {border: solid thin #ffcc66; padding: 1em; background: #ffffcc; }.node-unclaimed {border: dotted thin #c3c3c3; padding: 1em; background: #fafafa; color: red; }.node-disabled {border: solid thin #f55; padding: 1em; background: #fee; color: gray; }
</style>
<title>gxxc-ce3000f</title>
</head>
<body>
<div class="indented">
<div class="indented">
</div>
<div class="indented"><div class="indented"><table width="100%" class="node" summary="attributes of cpu:0"><thead><tr><td class="first">id:</td><td class="second"><div class="id">cpu:0</div></td></tr></thead><tbody><tr><td class="first">physical id: </td><td class="second"><div class="id">7</div></td></tr><tr><td class="first">bus info: </td><td class="second"><div class="id">cpu@0</div></td></tr><tr><td class="first">size: </td><td class="second">2600MHz</td></tr><tr><td class="first">capacity: </td><td class="second">2600MHz</td></tr><tr><td class="first">capabilities: </td><td class="second"><dfn title="Floating point instructions">fp</dfn> <dfn title="Advanced SIMD">asimd</dfn> <dfn title="Event stream">evtstrm</dfn> <dfn title="AES instructions">aes</dfn> <dfn title="PMULL instruction">pmull</dfn> <dfn title="SHA1 instructions">sha1</dfn> <dfn title="SHA2 instructions">sha2</dfn> <dfn title="CRC extension">crc32</dfn> <dfn title="CPU Frequency scaling">cpufreq</dfn> </td></tr></tbody>    </table></div></div>
<div class="indented"><div class="indented"><table width="100%" class="node" summary="attributes of cpu:1"><thead><tr><td class="first">id:</td><td class="second"><div class="id">cpu:1</div></td></tr></thead><tbody><tr><td class="first">physical id: </td><td class="second"><div class="id">8</div></td></tr><tr><td class="first">bus info: </td><td class="second"><div class="id">cpu@1</div></td></tr><tr><td class="first">size: </td><td class="second">2600MHz</td></tr><tr><td class="first">capacity: </td><td class="second">2600MHz</td></tr><tr><td class="first">capabilities: </td><td class="second"><dfn title="Floating point instructions">fp</dfn> <dfn title="Advanced SIMD">asimd</dfn> <dfn title="Event stream">evtstrm</dfn> <dfn title="AES instructions">aes</dfn> <dfn title="PMULL instruction">pmull</dfn> <dfn title="SHA1 instructions">sha1</dfn> <dfn title="SHA2 instructions">sha2</dfn> <dfn title="CRC extension">crc32</dfn> <dfn title="CPU Frequency scaling">cpufreq</dfn> </td></tr></tbody>    </table></div></div>
<div class="indented"><div class="indented"><table width="100%" class="node" summary="attributes of cpu:2"><thead><tr><td class="first">id:</td><td class="second"><div class="id">cpu:2</div></td></tr></thead><tbody><tr><td class="first">physical id: </td><td class="second"><div class="id">9</div></td></tr><tr><td class="first">bus info: </td><td class="second"><div class="id">cpu@2</div></td></tr><tr><td class="first">size: </td><td class="second">2600MHz</td></tr><tr><td class="first">capacity: </td><td class="second">2600MHz</td></tr><tr><td class="first">capabilities: </td><td class="second"><dfn title="Floating point instructions">fp</dfn> <dfn title="Advanced SIMD">asimd</dfn> <dfn title="Event stream">evtstrm</dfn> <dfn title="AES instructions">aes</dfn> <dfn title="PMULL instruction">pmull</dfn> <dfn title="SHA1 instructions">sha1</dfn> <dfn title="SHA2 instructions">sha2</dfn> <dfn title="CRC extension">crc32</dfn> <dfn title="CPU Frequency scaling">cpufreq</dfn> </td></tr></tbody>    </table></div></div>
<div class="indented"><div class="indented"><table width="100%" class="node" summary="attributes of cpu:3"><thead><tr><td class="first">id:</td><td class="second"><div class="id">cpu:3</div></td></tr></thead><tbody><tr><td class="first">physical id: </td><td class="second"><div class="id">a</div></td></tr><tr><td class="first">bus info: </td><td class="second"><div class="id">cpu@3</div></td></tr><tr><td class="first">size: </td><td class="second">2600MHz</td></tr><tr><td class="first">capacity: </td><td class="second">2600MHz</td></tr><tr><td class="first">capabilities: </td><td class="second"><dfn title="Floating point instructions">fp</dfn> <dfn title="Advanced SIMD">asimd</dfn> <dfn title="Event stream">evtstrm</dfn> <dfn title="AES instructions">aes</dfn> <dfn title="PMULL instruction">pmull</dfn> <dfn title="SHA1 instructions">sha1</dfn> <dfn title="SHA2 instructions">sha2</dfn> <dfn title="CRC extension">crc32</dfn> <dfn title="CPU Frequency scaling">cpufreq</dfn> </td></tr></tbody>    </table></div></div>
<div class="indented">
</div>
<div class="indented">
<div class="indented">
</div>
</div>
<div class="indented">
<div class="indented">
</div>
</div>
<div class="indented">
</div>
<div class="indented">
</div>
<div class="indented">
<div class="indented">
</div>
</div>
<div class="indented">
<div class="indented">
</div>
</div>
</div>
<div class="indented">
</div>
</body>
</html>
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
[purpleendurer @ bash ~ ]

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/847833.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C++之noexcept

目录 1.概述 2.noexcept作为说明符 3.noexcept作为运算符 4.传统throw与noexcept比较 5.原理剖析 6.总结 1.概述 在C中&#xff0c;noexcept是一个关键字&#xff0c;用于指定函数不会抛出异常。如果函数保证不会抛出异常&#xff0c;编译器可以进行更多优化&#xff0c;…

C语言.数据结构.单链表经典算法

数据结构.单链表经典算法 1.经典算法OJ题1&#xff1a;移除链表元素1.1题目描述&#xff1a;1.2题解&#xff1a;1.3图文解释&#xff1a; 2.经典算法OJ题2&#xff1a;反转链表2.1题目描述&#xff1a;2.2题解&#xff1a;2.3图文解释 3.经典算法OJ题3&#xff1a;合并两个有序…

编译和运行qemu-uboot-arm64单板的Armbian系统

这篇文章ARM虚拟机安装OMV-CSDN博客遗留一个启动qemu-uboot-arm64单板Armbian镜像的问题&#xff0c;使用官方下载的镜像&#xff0c;会报错&#xff1a; fatal: no kernel available .... Failed to load /vmlinuz ...... qemu-system-aarch64 -smp 8 -m 8G -machine virt …

WPF音乐播放器 零基础4个小时左右

前言&#xff1a;winfrom转wpf用久的熟手说得最多的是,转回去做winfrom难。。当时不明白。。做一个就知道了。 WPF音乐播放器 入口主程序 FontFamily"Microsoft YaHei" FontSize"12" FontWeight"ExtraLight" 居中显示WindowStartupLocation&quo…

数据结构:并查集

数据结构&#xff1a;并查集 题目描述参考代码 题目描述 输入样例 5 5 C 1 2 Q1 1 2 Q2 1 C 2 5 Q2 5输出样例 Yes 2 3参考代码 #include <iostream>using namespace std;const int N 100010;int n, m; int p[N], sz[N];int find(int x) // 返回x的祖宗节点 路径…

山东大学软件学院项目实训-创新实训-基于大模型的旅游平台(二十六)- 微服务(6)

目录 10. Docker 10.1 Docker基本操作 10.1.1 镜像相关命令 10.1.2 容器相关命令 10.2 数据卷命令 10.2.1 常用命令 : 10.2.2 挂载数据卷 10. Docker 10.1 Docker基本操作 10.1.1 镜像相关命令 docker --help 查看docker帮助文档 docker images --help 查看docker ima…

Java中条件运算符的嵌套使用技巧总结

哈喽&#xff0c;各位小伙伴们&#xff0c;你们好呀&#xff0c;我是喵手。运营社区&#xff1a;C站/掘金/腾讯云&#xff1b;欢迎大家常来逛逛 今天我要给大家分享一些自己日常学习到的一些知识点&#xff0c;并以文字的形式跟大家一起交流&#xff0c;互相学习&#xff0c;一…

c语言项目-贪吃蛇项目2-游戏的设计与分析

文章目录 前言游戏的设计与分析地图&#xff1a;这里简述一下c语言的国际化特性相关的知识<locale.h> 本地化头文件类项setlocale函数 上面我们讲到需要打印★&#xff0c;●&#xff0c;□三个宽字符找到这三个字符打印的方式有两种&#xff1a; 控制台屏幕的长宽特性&a…

C++笔试强训day38

目录 1.天使果冻 2.dd爱旋转 3.小红取数 1.天使果冻 链接https://ac.nowcoder.com/acm/problem/219641 一开始都可以想到将数组的前x个数拿出来排降序输出第二个数即可。 但是因为询问量和数据量都较大&#xff0c;每次询问一次都要排序一次数组&#xff0c;会超时&#xf…

ai聊天机器人app的分享!有4个热门的软件!

在科技日新月异的今天&#xff0c;AI聊天机器人已经不再是遥不可及的科幻概念&#xff0c;而是实实在在走进了我们的日常生活。无论是工作中的信息查询&#xff0c;还是生活中的闲聊解闷&#xff0c;这些智能助手都能为我们提供便捷、高效的服务。那么&#xff0c;市面上都有哪…

含有嘧啶的光活性阳离子共轭微孔聚合物通过“吸附杀死”抗菌策略促进感染伤口愈合

引用信息&#xff1a; 文 章&#xff1a;Photoactive cationic conjugated microporous polymers containing pyrimidine with an adsorption-killantibacterial strategy for infected wound healing. 期 刊&#xff1a;Chemical Engineering Journal&#xff08;影响因子…

【MySQL】sql语句之库操作

序言 在上篇文章学习当中&#xff0c;我们认识了数据库的相关概念&#xff0c;以及MySQL的框架和基本使用等内容&#xff0c;总之对数据库有了一个大致的认识&#xff0c;那么本篇文章将开始关于sql语句的学习&#xff0c;本文主要是关于库的属性和操作的内容&#xff0c;简单可…

stm32下载驱动ST-LINK/V2驱动下载

http://www.openedv.com/docs/tool/dap/ST-LINKV2.html https://www.stmcu.com.cn/Designresource/detail/fi rmware_software/709492

电商风控指南:“仅退款”成部分商家梦魇,如何有效防控非法牟利

目录 “仅退款”成不法分子牟利新途径 各电商平台的“仅退款”条款模糊 商家如何防范“仅退款”的欺诈 “仅退款”服务已成为各大电商平台的“标配”。然而&#xff0c;以“薅羊毛”的方式谋取不当利益&#xff0c;给商家造成了经济和声誉上的双重损失&#xff0c;引发了广泛关…

CentOS-内网搭建FTP-Server

一、镜像选择 1、 Centos-everting或者DVD 2、7.5 7.6 7.9 均可 二、安装步骤 1、其余步骤和普通安装一致。 2、最重要的一步为“软件选择” 1、勾选FTP、文件以及存储服务器、性能以及开发工具。 三、FTPServer搭建 1、关闭防火墙 systemctl stop firewalld or 通过21和20…

机器视觉——找到物块中心点

首先先介绍一下我用的是HALCON中的HDevelop软件。 大家下载好软件后可以测试一下&#xff1a; 在程序编辑器窗口中输入下面指令&#xff1a; read_image(Image,monkey) 那么如果出现这样的图片&#xff0c;说明是没有问题的 那么本次编程采用的是下面这张图片 我们要达到的…

【论文复现|智能算法改进】基于改进麻雀算法的无线传感器网络覆盖优化研究

目录 1.算法原理2.改进点3.结果展示4.参考文献5.代码获取 1.算法原理 【智能算法】麻雀搜索算法&#xff08;SSA&#xff09;原理及实现 WSN数学模型 2.改进点 基于Sobol序列和ICMIC混沌映射的种群初始化 ICMIC是一种无线映射折叠次数的映射模型: { z n 1 sin ⁡ ( α π…

客户案例|Zilliz Cloud 助力点石科技转型 AI 智能服务商

福建点石科技网络科技有限公司成立于2010年&#xff0c;是国家高新技术企业&#xff0c;阿里云、蚂蚁金服等大厂海内外生态合作伙伴ISV。在餐饮、零售、酒店、旅游、商圈的行业定制化服务化上有深厚积累&#xff0c;在境内外做了大量标杆性软件项目&#xff0c;如东南亚RWS圣淘…

Python | 试卷刷题and基础笔记

1.下列转义字符中&#xff0c; 属于“回车”含义的是 \n 换行 \r 回车 2.for循环遍历字典 在Python中&#xff0c;你可以使用for循环来遍历字典的键&#xff08;keys&#xff09;、值&#xff08;values&#xff09;或者键-值对&#xff08;items&#xff09;。下面是三种遍历…

Postman接口测试笔记(超详细)

基于工具Poatman的接口自动化基础应用以及接口关联 一、什么是接口&#xff1f; 硬件接口&#xff1a;USB接口&#xff0c;投影仪接口&#xff0c;鼠标键盘接口 软件接口&#xff1a;称为API&#xff0c;主要使用于数据交互 软件接口分类&#xff1a; 内部接口&#xff1a…