如何使用inxi查找Linux系统详细信息
Inxi是一个免费,开源且功能齐全的命令行系统信息工具。
它显示了系统硬件,CPU,驱动程序,Xorg,桌面,内核,GCC版本,进程,内存使用情况以及各种其他有用的信息。
无论是硬盘,CPU,主板还是整个系统的完整细节,inxi都可以在几秒钟内更准确地显示出来。
由于它是CLI工具,因此可以在桌面版或者服务器版中使用它。
大多数Linux发行版和某些BSD系统的默认存储库中都可以使用Inxi。
安装inxi
在Arch Linux及其衍生版本上:
要在Arch Linux或者其衍生版本(如Antergos和Manajaro Linux)中安装inxi,请运行:
$sudo pacman -S inxi
以防万一,如果默认存储库中没有Inxi,请尝试使用任何AUR帮助程序从AUR(每年不同)进行安装。
使用Yay:
$yay -S inxi
在Debian/Ubuntu及其衍生版本上:
$sudo apt-get install inxi
在Fedora/RHEL/CentOS/Scientific Linux上:
inxi在Fedora默认存储库中可用。
因此,只需运行以下命令即可立即安装。
$sudo dnf install inxi
在RHEL及其CentOS和Scientific Linux之类的克隆中,我们需要添加EPEL存储库,然后安装inxi。
要安装EPEL信息库,只需运行:
$sudo yum install epel-release
安装EPEL信息库后,使用以下命令安装inxi:
$sudo yum install inxi
在SUSE/openSUSE上:
$sudo zypper install inxi
使用inxi查找Linux系统详细信息
inxi将需要一些其他程序才能正常运行。
它们将与inxi一起安装。
但是,如果未自动安装它们,则需要查找并安装它们。
要列出所有必需的程序,请运行:
$inxi --recommends
如果我们看到任何丢失的程序,请在开始使用inxi之前安装它们。
现在,让我们看看如何使用它来揭示Linux系统的细节。
inxi用法非常简单直接。
打开终端并运行以下命令,以打印CPU,内存,硬盘驱动器和内核信息的简短摘要:
$inxi
输出示例:
CPU: Dual Core Intel Core i3-2350M (-MT MCP-) speed/min/max: 798/800/2300 MHz Kernel: 5.1.2-arch1-1-ARCH x86_64 Up: 1h 31m Mem: 2800.5/7884.2 MiB (35.5%) Storage: 465.76 GiB (80.8% used) Procs: 163 Shell: bash 5.0.7 inxi: 3.0.34
如我们所见,Inxi显示了我的Arch Linux桌面的以下详细信息:
- CPU类型
- CPU速度
- 内核详细信息,
- 正常运行时间
- 内存详细信息(总内存和已用内存),
- 硬盘大小以及当前使用情况,
- 程序,
- 默认shell详细信息,
- Inxi版本。
要显示完整的摘要,请使用“ -F”开关,如下所示。
$inxi -F
输出示例:
System: Host: sk Kernel: 5.1.2-arch1-1-ARCH x86_64 bits: 64 Desktop: Deepin 15.10.1 Distro: Arch Linux Machine: Type: Portable System: Dell product: Inspiron N5050 v: N/A serial: <root required> Mobo: Dell model: 01HXXJ v: A05 serial: <root required> BIOS: Dell v: A05 date: 08/03/2012 Battery: ID-1: BAT0 charge: 39.0 Wh condition: 39.0/48.8 Wh (80%) CPU: Topology: Dual Core model: Intel Core i3-2350M bits: 64 type: MT MCP L2 cache: 3072 KiB Speed: 798 MHz min/max: 800/2300 MHz Core speeds (MHz): 1: 798 2: 798 3: 798 4: 798 Graphics: Device-1: Intel 2nd Generation Core Processor Family Integrated Graphics driver: i915 v: kernel Display: x11 server: X.Org 1.20.4 driver: modesetting unloaded: vesa resolution: 1366x768~60Hz Message: Unable to show advanced data. Required tool glxinfo missing. Audio: Device-1: Intel 6 Series/C200 Series Family High Definition Audio driver: snd_hda_intel Sound Server: ALSA v: k5.1.2-arch1-1-ARCH Network: Device-1: Realtek RTL810xE PCI Express Fast Ethernet driver: r8169 IF: enp5s0 state: down mac: 45:c8:gh:89:b6:45 Device-2: Qualcomm Atheros AR9285 Wireless Network Adapter driver: ath9k IF: wlp9s0 state: up mac: c3:11:96:22:87:3g Device-3: Qualcomm Atheros AR3011 Bluetooth type: USB driver: btusb Drives: Local Storage: total: 465.76 GiB used: 376.31 GiB (80.8%) ID-1: /dev/sda vendor: Seagate model: ST9500325AS size: 465.76 GiB Partition: ID-1:/size: 456.26 GiB used: 376.25 GiB (82.5%) fs: ext4 dev: /dev/sda2 ID-2: /boot size: 92.8 MiB used: 62.9 MiB (67.7%) fs: ext4 dev: /dev/sda1 ID-3: swap-1 size: 2.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/sda3 Sensors: System Temperatures: cpu: 58.0 C mobo: N/A Fan Speeds (RPM): cpu: 3445 Info: Processes: 169 Uptime: 1h 38m Memory: 7.70 GiB used: 2.94 GiB (38.2%) Shell: bash inxi: 3.0.34
IRC上使用的Inxi会自动过滤出网络设备MAC地址,WAN和LAN IP,分区中的/home用户名目录以及其他一些项目,以维护基本的隐私和安全性。
我们也可以使用-z选项触发此过滤,如下所示。
$inxi -Fz
要覆盖IRC过滤器,请使用-Z选项。
$inxi -FZ
例如,这对于在私有聊天中在线调试网络连接问题很有用。
使用-Z选项时请非常小心。
它将显示MAC地址。
我们不应该在公共论坛上分享使用-Z选项获得的结果。
显示特定于设备的详细信息
当不带任何选项运行inxi时,我们将获得系统的基本详细信息,例如CPU,内存,内核,正常运行时间,硬盘等。
当然,我们可以使用各种选项来缩小结果范围以显示特定的设备详细信息。
Inxi有多种选择(大写和小写)。
首先,我们将按字母顺序查看所有大写选项的示例命令。
某些命令可能需要root/sudo特权才能获取实际数据。
大写选项
1.显示音频/声卡的详细信息
要使用声卡驱动程序显示音频和声卡信息,请使用-A选项。
$inxi -A Audio: Device-1: Intel 6 Series/C200 Series Family High Definition Audio driver: snd_hda_intel Sound Server: ALSA v: k5.1.2-arch1-1-ARCH
2.显示电池详细信息
要显示当前电量和状态的系统电池详细信息,请使用-B选项。
$ inxi -B Battery: ID-1: BAT0 charge: 39.0 Wh condition: 39.0/48.8 Wh (80%)
3.显示CPU详细信息
要显示完整的CPU详细信息,包括内核数量,CPU型号,CPU缓存,CPU时钟速度,CPU最小/最大速度等,请使用-C选项。
$inxi -C CPU: Topology: Dual Core model: Intel Core i3-2350M bits: 64 type: MT MCP L2 cache: 3072 KiB Speed: 798 MHz min/max: 800/2300 MHz Core speeds (MHz): 1: 798 2: 798 3: 798 4: 798
4.显示硬盘详细信息
要显示有关硬盘驱动器的信息,例如磁盘类型,供应商,设备ID,型号,磁盘大小,总磁盘空间,已用百分比等,请使用-D选项。
$inxi -D Drives: Local Storage: total: 465.76 GiB used: 376.31 GiB (80.8%) ID-1: /dev/sda vendor: Seagate model: ST9500325AS size: 465.76 GiB
5.显示图形详细信息
要显示有关图形卡的详细信息,包括图形卡,驱动程序,供应商,显示服务器,分辨率等的详细信息,请使用-G选项。
$inxi -G Graphics: Device-1: Intel 2nd Generation Core Processor Family Integrated Graphics driver: i915 v: kernel Display: x11 server: X.Org 1.20.4 driver: modesetting unloaded: vesa resolution: 1366x768~60Hz Message: Unable to show advanced data. Required tool glxinfo missing.
6.显示有关进程,正常运行时间,内存,inxi版本的详细信息
要显示有关进程数,总运行时间,已使用内存的总内存,Shell详细信息和inxi版本等信息,请使用-I选项。
$inxi -I Info: Processes: 170 Uptime: 5h 47m Memory: 7.70 GiB used: 3.27 GiB (42.4%) Shell: bash inxi: 3.0.34
7.显示主板详细信息
要显示有关计算机详细信息,制造商,主板,BIOS的信息,请使用-M选项。
$inxi -M Machine: Type: Portable System: Dell product: Inspiron N5050 v: N/A serial: <root required> Mobo: Dell model: 034ygt v: A018 serial: <root required> BIOS: Dell v: A001 date: 09/04/2014
8.显示网卡详细信息
要显示有关网卡的信息,包括供应商,卡驱动程序以及任何网络接口等,请使用-N选项。
$inxi -N Network: Device-1: Realtek RTL810xE PCI Express Fast Ethernet driver: r8169 Device-2: Qualcomm Atheros AR9285 Wireless Network Adapter driver: ath9k Device-3: Qualcomm Atheros AR3011 Bluetooth type: USB driver: btusb
如果要显示网卡的高级详细信息,例如MAC地址,NIC的速度和状态,请使用-n选项。
$inxi -n
请在公共论坛上仔细分享此详细信息。
9.显示分区详细信息
要显示基本分区信息,请使用-P选项。
$inxi -P Partition: ID-1:/size: 456.26 GiB used: 376.25 GiB (82.5%) fs: ext4 dev: /dev/sda2 ID-2: /boot size: 92.8 MiB used: 62.9 MiB (67.7%) fs: ext4 dev: /dev/sda1 ID-3: swap-1 size: 2.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/sda3
要显示包括安装点在内的完整分区信息,请使用-p选项。
$inxi -p
10.显示RAID详细信息
要显示RAID信息,请使用-R选项。
$inxi -R
11.显示系统详细信息
要显示Linux系统信息,例如主机名,内核,DE,OS版本等,请使用-S选项。
$inxi -S System: Host: sk Kernel: 5.1.2-arch1-1-ARCH x86_64 bits: 64 Desktop: Deepin 15.10.1 Distro: Arch Linux
12.显示天气详细信息
Inixi不仅用于查找硬件详细信息。
这对于获取其他东西也很有用。
例如,我们可以显示给定位置的天气详细信息。
为此,请使用-W选项运行inxi,如下所示。
$inxi -W 95623,us Weather: Temperature: 21.1 C (70 F) Conditions: Scattered clouds Current Time: Tue 11 Jun 2019 04:34:35 AM PDT Source: WeatherBit.io
请注意,在城市/州/国家/地区名称中只能使用ASCII字母以获得有效的结果。
小写选项
1.显示基本系统详细信息
要仅显示系统详细信息的基本摘要,请使用-b选项。
$inxi -b
或者,我们可以使用以下命令:
两台服务器具有相同的用途。
$inxi -v 2
2.设置配色方案
我们可以使用-c选项为inxi输出设置不同的配色方案。
Yu可以将颜色方案编号设置为0到42.
如果未提供任何方案编号,则假定为0。
这是带有和不带有-c选项的inxi输出。
如我们所见,当我们使用-c选项运行inxi时,将禁用配色方案。
当将不带转义码的纯输出重定向到文本文件时,-c选项对于关闭彩色输出很有用。
同样,我们可以使用其他配色方案值。
$inxi -c10
$inxi -c42
3.显示光盘驱动器详细信息
我们可以使用-d选项显示光盘驱动器数据详细信息以及本地硬盘驱动器详细信息。
$inxi -d Drives: Local Storage: total: 465.76 GiB used: 376.31 GiB (80.8%) ID-1: /dev/sda vendor: Seagate model: ST9500325AS size: 465.76 GiB Optical-1: /dev/sr0 vendor: PLDS model: DVD+-RW DS-8A8SH dev-links: cdrom Features: speed: 24 multisession: yes audio: yes dvd: yes rw: cd-r,cd-rw,dvd-r,dvd-ram
4.显示所有CPU标志
要显示所有使用的CPU标志,请运行:
$inxi -f
5.显示IP详细信息
要显示WAN和本地IP地址以及网卡详细信息(例如设备供应商,驱动程序,mac,状态等),请使用-i选项。
$inxi -i
6.显示分区标签
如果已为分区设置了标签,则可以使用-l选项查看它们。
$inxi -l
我们还可以使用以下命令查看所有分区的标签以及安装点:
$inxi -pl
7.显示内存详细信息
我们可以使用-m选项显示内存详细信息,例如已安装的内存的总大小,已使用的内存量,可用的DIMM插槽数,受支持的内存的总大小,每个插槽中当前安装了多少内存等。
$sudo inxi -m [sudo] password for sk: Memory: 内存: total: 7.70 GiB used: 2.26 GiB (29.3%) Array-1: capacity: 16 GiB slots: 2 EC: None Device-1: DIMM_A size: 4 GiB speed: 1067 MT/s Device-2: DIMM_B size: 4 GiB speed: 1067 MT/s
8.显示卸载的分区详细信息
要显示已卸载分区的详细信息,请使用-o选项。
$inxi -o
如果系统中没有卸载的分区,我们将看到类似以下的输出。
Unmounted: Message: No unmounted partitions found.
9.显示存储库列表
要显示系统中存储库的列表,请使用-r选项。
$inxi -r
输出示例:
Repos: Active apt sources in file: /etc/apt/sources.list deb http://in.archive.ubuntu.com/ubuntu/xenial main restricted deb http://in.archive.ubuntu.com/ubuntu/xenial-updates main restricted deb http://in.archive.ubuntu.com/ubuntu/xenial universe deb http://in.archive.ubuntu.com/ubuntu/xenial-updates universe deb http://in.archive.ubuntu.com/ubuntu/xenial multiverse deb http://in.archive.ubuntu.com/ubuntu/xenial-updates multiverse deb http://in.archive.ubuntu.com/ubuntu/xenial-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu xenial-security main restricted deb http://security.ubuntu.com/ubuntu xenial-security universe deb http://security.ubuntu.com/ubuntu xenial-security multiverse
10.显示系统温度,风扇速度详细信息
Inxi能够找到主板/CPU/GPU温度和风扇速度。
$inxi -s Sensors: System Temperatures: cpu: 60.0 C mobo: N/A Fan Speeds (RPM): cpu: 3456
请注意,Inxi需要传感器才能找到系统温度。
确保已在系统中安装并正确配置了lm_sensors。
11.显示有关流程的详细信息
要显示列出进程的前5个进程,它们消耗了最多的CPU和内存,只需运行:
$inxi -t Processes: CPU top: 5 1: cpu: 14.3% command: firefox pid: 15989 2: cpu: 10.5% command: firefox pid: 13487 3: cpu: 7.1% command: firefox pid: 15062 4: cpu: 3.1% command: xorg pid: 13493 5: cpu: 3.0% command: firefox pid: 14954 System 内存: total: 7.70 GiB used: 2.99 GiB (38.8%) Memory top: 5 1: mem: 1115.8 MiB (14.1%) command: firefox pid: 15989 2: mem: 606.6 MiB (7.6%) command: firefox pid: 13487 3: mem: 339.3 MiB (4.3%) command: firefox pid: 13630 4: mem: 303.1 MiB (3.8%) command: firefox pid: 18617 5: mem: 260.1 MiB (3.2%) command: firefox pid: 15062
我们还可以按CPU使用率或者内存使用率对该输出进行排序。
例如,要查找消耗最大内存的前5个进程,请使用以下命令:
$inxi -t m Processes: System 内存: total: 7.70 GiB used: 2.73 GiB (35.4%) Memory top: 5 1: mem: 966.1 MiB (12.2%) command: firefox pid: 15989 2: mem: 468.2 MiB (5.9%) command: firefox pid: 13487 3: mem: 347.9 MiB (4.4%) command: firefox pid: 13708 4: mem: 306.7 MiB (3.8%) command: firefox pid: 13630 5: mem: 247.2 MiB (3.1%) command: firefox pid: 15062
要根据CPU使用率对前5个进程进行排序,请运行:
$inxi -t c Processes: CPU top: 5 1: cpu: 14.9% command: firefox pid: 15989 2: cpu: 10.6% command: firefox pid: 13487 3: cpu: 7.0% command: firefox pid: 15062 4: cpu: 3.1% command: xorg pid: 13493 5: cpu: 2.9% command: firefox pid: 14954
默认情况下,Inxi将显示前5个进程。
我们可以更改进程数,例如10,如下所示。
$inxi -t cm10 Processes: CPU top: 10 1: cpu: 14.9% command: firefox pid: 15989 2: cpu: 10.6% command: firefox pid: 13487 3: cpu: 7.0% command: firefox pid: 15062 4: cpu: 3.1% command: xorg pid: 13493 5: cpu: 2.9% command: firefox pid: 14954 6: cpu: 2.8% command: firefox pid: 13630 7: cpu: 1.8% command: firefox pid: 18325 8: cpu: 1.4% command: firefox pid: 18617 9: cpu: 1.3% command: firefox pid: 13708 10: cpu: 0.8% command: firefox pid: 14427 System 内存: total: 7.70 GiB used: 2.92 GiB (37.9%) Memory top: 10 1: mem: 1160.9 MiB (14.7%) command: firefox pid: 15989 2: mem: 475.1 MiB (6.0%) command: firefox pid: 13487 3: mem: 353.4 MiB (4.4%) command: firefox pid: 13708 4: mem: 308.0 MiB (3.9%) command: firefox pid: 13630 5: mem: 269.6 MiB (3.4%) command: firefox pid: 15062 6: mem: 249.3 MiB (3.1%) command: firefox pid: 14427 7: mem: 238.5 MiB (3.0%) command: firefox pid: 14954 8: mem: 208.2 MiB (2.6%) command: firefox pid: 18325 9: mem: 194.0 MiB (2.4%) command: firefox pid: 18617 10: mem: 143.6 MiB (1.8%) command: firefox pid: 23960
上面的命令将显示消耗最多CPU和内存的前10个进程。
要仅基于内存使用量显示top10,请运行:
$inxi -t m10
12.显示分区UUID详细信息
要显示分区UUID(通用唯一标识符),请使用-u选项。
$inxi -u
还有更多的选择尚待讨论。
但是,这些仅足以获取Linux盒的几乎所有详细信息。
有关更多详细信息和选项,请参考手册页。
$man inxi