皇上,还记得我吗?我就是1999年那个Linux伊甸园啊-----24小时滚动更新开源资讯,全年无休!

Linux inxi 命令的 3 种使用方法

Linux inxi 命令的 3 种使用方法

我在 Linux 上使用 inxi 来检查我的笔记本电脑电池、CPU 信息,甚至天气。

当我在查询有关笔记本电脑电池健康状况的信息时,我偶然发现了 inxi。它是一个命令行系统信息工具,可提供有关你的 Linux 计算机(无论是笔记本电脑、台式机还是服务器)的大量信息。

inxi 命令采用 GPLv3 许可证,许多 Linux 发行版都包含它。据它的 Git 存储库称:“inxi 努力支持最广泛的操作系统和硬件,从最简单的消费台式机到最先进的专业硬件和服务器。”

文档很完善,并且该项目在线维护了完整的 手册页。安装后,你可以使用 man inxi 命令访问系统上的手册页。

在 Linux 上安装 inxi

通常,你可以从发行版的软件仓库或应用中心安装 inxi。例如,在 Fedora、CentOS、Mageia 或类似发行版上:

  1. $ sudo dnf install inxi

在 Debian、Elementary、Linux Mint 或类似发行版上:

  1. $ sudo apt install inxi

你可以在 此处 找到有关 Linux 发行版安装选项的更多信息。

在 Linux 上使用 inxi 的 3 种方法

当你安装了 inxi,你可以探索它的所有选项。有许多选项可帮助你了解有关系统的更多信息。最基本的命令提供了系统的基本概览:

  1. $ inxi -b
  2. System:
  3. Host: pop-os Kernel: 5.19.0-76051900-generic x86_64 bits: 64
  4. Desktop: GNOME 42.3.1 Distro: Pop!_OS 22.04 LTS
  5. Machine:
  6. Type: Laptop System: HP product: Dev One Notebook PC v: N/A
  7. serial: <superuser required>
  8. Mobo: HP model: 8A78 v: KBC Version 01.03 serial: <superuser required>
  9. UEFI: Insyde v: F.05 date: 06/14/2022
  10. Battery:
  11. ID-1: BATT charge: 50.6 Wh (96.9%) condition: 52.2/53.2 Wh (98.0%)
  12. CPU:
  13. Info: 8-core AMD Ryzen 7 PRO 5850U with Radeon Graphics [MT MCP]
  14. speed (MHz): avg: 915 min/max: 400/4507
  15. Graphics:
  16. Device-1: AMD Cezanne driver: amdgpu v: kernel
  17. Device-2: Quanta HP HD Camera type: USB driver: uvcvideo
  18. Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: amdgpu,ati
  19. unloaded: fbdev,modesetting,radeon,vesa gpu: amdgpu
  20. resolution: 1920x1080~60Hz
  21. OpenGL:
  22. renderer: AMD RENOIR (LLVM 13.0.1 DRM 3.47 5.19.0-76051900-generic)
  23. v: 4.6 Mesa 22.0.5
  24. Network:
  25. Device-1: Realtek RTL8822CE 802.11ac PCIe Wireless Network Adapter
  26. driver: rtw_8822ce
  27. Drives:
  28. Local Storage: total: 953.87 GiB used: 75.44 GiB (7.9%)
  29. Info:
  30. Processes: 347 Uptime: 15m Memory: 14.96 GiB used: 2.91 GiB (19.4%)
  31. Shell: Bash inxi: 3.3.13

1、显示电池状态

你可以使用 -B 选项检查电池健康状况。结果显示系统电池 ID、充电情况和其他信息:

  1. $ inxi -B
  2. Battery:
  3. ID-1: BATT charge: 44.3 Wh (85.2%) condition: 52.0/53.2 Wh (97.7%)

2、显示 CPU 信息

使用 -C 选项了解有关 CPU 的更多信息:

  1. $ inxi -C
  2. CPU:
  3. Info: 8-core model: AMD Ryzen 7 PRO 5850U with Radeon Graphics bits: 64
  4. type: MT MCP cache: L2: 4 MiB
  5. Speed (MHz): avg: 400 min/max: 400/4507 cores: 1: 400 2: 400 3: 400
  6. 4: 400 5: 400 6: 400 7: 400 8: 400 9: 400 10: 400 11: 400 12: 400 13: 400
  7. 14: 400 15: 400 16: 400

inxi 的输出默认使用彩色文本。你可以根据需要使用“颜色开关”进行更改以提高可读性。

命令选项是 -c 后跟 0 到 42 之间的任意数字以适合你的习惯。

  1. $ inxi -c 42

以下是使用配色 5 和 7 的几个不同选项的示例:

Linux inxi 命令的 3 种使用方法

inxi -c 5 command

该软件可以使用 Linux 系统中的传感器显示硬件温度、风扇速度和有关系统的其他信息。输入 inxi -s 并读取以下结果:

Linux inxi 命令的 3 种使用方法

inxi -s

3、组合选项

如果支持,你可以组合 inxi 的选项以获得复杂的输出。例如,inxi -S 提供系统信息,-v 提供详细输出。将两者结合起来可以得到以下结果:

  1. $ inxi -S
  2. System:
  3. Host: pop-os Kernel: 5.19.0-76051900-generic x86_64 bits: 64
  4. Desktop: GNOME 42.3.1 Distro: Pop!_OS 22.04 LTS
  5. $ inxi -Sv
  6. CPU: 8-core AMD Ryzen 7 PRO 5850U with Radeon Graphics (-MT MCP-)
  7. speed/min/max: 634/400/4507 MHz Kernel: 5.19.0-76051900-generic x86_64
  8. Up: 20m Mem: 3084.2/15318.5 MiB (20.1%) Storage: 953.87 GiB (7.9% used)
  9. Procs: 346 Shell: Bash inxi: 3.3.13

额外功能:查看天气

inxi 可以收集到的信息并不只有你的电脑。使用 -w 选项,你还可以获取你所在地区的天气信息:

  1. $ inxi -w
  2. Weather:
  3. Report: temperature: 14 C (57 F) conditions: Clear sky
  4. Locale: Wellington, G2, NZL
  5. current time: Tue 30 Aug 2022 16:28:14 (Pacific/Auckland)
  6. Source: WeatherBit.io

你可以通过指定你想要的城市和国家以及 -W 来获取世界其他地区的天气信息:

  1. $ inxi -W rome,italy
  2. Weather:
  3. Report: temperature: 20 C (68 F) conditions: Clear sky
  4. Locale: Rome, Italy current time: Tue 30 Aug 2022 06:29:52
  5. Source: WeatherBit.io

总结

有许多很棒的工具可以收集有关你的计算机的信息。我根据机器、桌面或我的心情使用不同的工具。你最喜欢的系统信息工具是什么?

图片来源:(Don Watkins,CC BY-SA 4.0)


via: https://opensource.com/article/22/9/linux-inxi-command

作者:Don Watkins 选题:lkxed 译者:geekpi 校对:wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出