How to get macOS CPU details information in the command line All In One
如何通过
命令行
获取 macOSCPU
的详细信息
bug ❌
无法获取具体 CPU 版本
型号
,如 CPU 是第几代i7
3.2 GHz 6-Core Intel Core i7
❓
solutions
- Node.js
os
module ✅
import os from 'node:os'
// const os = require('node:os');
// console.log(`os =`, os)
// console.log(`os.arch =`, os.arch)
/* os.arch = [Function: arch] {
[Symbol(Symbol.toPrimitive)]: [Function (anonymous)]
} */
console.log(`os.arch() =`, os.arch())
console.log(`os.cpus() =`, os.cpus())
console.log(`os.cpus().length =`, os.cpus().length)
console.log(`os.cpus()[0] =`, os.cpus()[0])
console.log(`os.hostname() =`, os.hostname())
console.log(`os.platform() =`, os.platform())
console.log(`os.userInfo() =`, os.userInfo())
console.log(`os.version() =`, os.version())
// console.log(`os =`, os)
$ node ./get-cpu-info.js
- npm
package
https://www.npmjs.com/package/systeminformation
- Linux
/proc/cpuinfo
# macOS 不好使 ❌
$ cat /proc/cpuinfo
system_profiler
❓
$ system_profiler
$ system_profiler > system_profiler.md
# 具体 CPU 型号信息隐藏了/加密了 ?
$ system_profiler | grep Processor
# $ system_profiler | grep Hardware
# Hardware:
Hardware Overview:
Model Name: Mac mini
Model Identifier: Macmini8,1
Processor Name: 6-Core Intel Core i7 # ❌
Processor Speed: 3.2 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 12 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
System Firmware Version: 1968.120.12.0.0 (iBridge: 20.16.5060.0.0,0)
OS Loader Version: 577~170
Serial Number (system): C07ZC0VTJYVY
Hardware UUID: FBE6D95A-0137-5929-904A-867894A0C40A
Provisioning UDID: FBE6D95A-0137-5929-904A-867894A0C40A
Activation Lock Status: Enabled
demos
(? 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!
refs
https://www.cnblogs.com/xgqfrms/p/17400616.html
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 ?️,侵权必究⚠️!
- information details command macOS lineinformation details command macos information mechanism detailed transfer command-line command-line-arguments command basics linux line command-line-arguments arguments undefined command flutter android command-line sdkmanager information command kernel linux line xxxapplication command running command xcode tools line