inxi是一个自由开源的全特性命令行系统信息工具。它可显示系统硬件、CPU、驱动、Xorg、桌面、内核、Gcc版本、进程、内存占用等广泛的系统的有用信息。不管是硬盘或者CPU,主板或者系统的完整细节,inxi会在几秒内精确地将其显示出。由于它是一个命令行CLI工具,你可以在桌面或者服务器上使用它。inxi在大多数Linux和一些BSD系统的默认软件仓库中都可以获取。
安装inxi
在Arch Linux以及其衍生发行版上:
要在Archlinux或者如Antergos、Manjaro这样的Arch衍生发行版上安装inxi,运行:
$ sudo pacman -S --noconfirm inxi
如果Inxi没有在默认软件仓库中,你可以尝试使用任何AUR助手通过AUR来安装它:
$ yay -S inxi
在Debian/Ubuntu和衍生发行版上:
$ sudo apt install inxi
在 Fedora/RHEL/CentOS/Scientific Linux上:
inxi在Fedora的默认仓库中可以获取。因此,只需要运行下面的命令就可以直接安装它:
# sudo dnf install inxi
在RHEL和其克隆版如CentOS和Scientific Linux上,你需要添加EPEL仓库然后安装inxi:
$ 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 速度
- Kernel 细节
- 挂起时间
- 内存细节(总的内存和已使用的内存),
- 硬盘尺寸以及当前使用率
- 进程
- 默认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: Mobo: Dell model: 01HXXJ v: A05 serial: 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 -AAudio: 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 -BBattery: ID-1: BAT0 charge: 39.0 Wh condition: 39.0/48.8 Wh (80%)
3. 显示CPU细节
要显示CPU的细节,包括有多少核、CPU模型、CPU缓存、CPU时钟频率、CPU最大最小速度等,使用-C选项。
$ inxi -CCPU: 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 -DDrives: 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 -GGraphics: 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 -IInfo: 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 -MMachine: Type: Portable System: Dell product: Inspiron N5050 v: N/A serial: Mobo: Dell model: 034ygt v: A018 serial: BIOS: Dell v: A001 date: 09/04/2015
8. 显示网卡细节
要显示你的网卡的细节,包括厂商、网卡驱动和网卡接口数量等,使用-N选项。
$ inxi -NNetwork: 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 -PPartition: 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细节
要显示RADI信息,使用-R选项。
$ inxi -R
11. 显示系统细节
要显示Linux系统的信息,比如主机名、内核、DE、OS版本等,使用-S选项。
$ inxi -SSystem: Host: sk Kernel: 5.1.2-arch1-1-ARCH x86_64 bits: 64 Desktop: Deepin 15.10.1 Distro: Arch Linux
12. 显示天气信息
Inxi不仅仅能用于获取硬件信息,它也能够用于其它方面。
例如,你可以显示一个给定区域的天气信息。要实现这点,通过-W选项来运行:
$ inxi -W 95623,usWeather: 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的输出设置不同的颜色方案。你可以设置颜色方案的值为从0到42.如果没有提供颜色方案编号,默认为0。
下面是有和没有-c选项对应的inxi的输出。
启用与不启用颜色方案
就如你所见,当使用-c选项运行inxi时,颜色方案是被禁用的。-c选项对于关闭颜色输出以在不用将代码转入文本文件的情况下重定向到干净的输出来说是非常有用的。
类似地,我们可以使用其它的颜色方案值。
$ inxi -c10$ inxi -c42
3. 显示光驱细节
我们可以使用-d选项来一起显示光驱数据细节和本地硬盘细节。
$ inxi -dDrives: 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选项显示内存细节,比如电脑总共安装的RAM大小,有多少内存已经被使用,可用的DIMM槽的数量,总共可支持的RAM大小,每个槽目前安装的RAM大小等。
$ sudo inxi -m[sudo] password for sk: Memory: RAM: 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 -sSensors: System Temperatures: cpu: 60.0 C mobo: N/A Fan Speeds (RPM): cpu: 3456
要注意Inxi需要sensors的支持来查看系统的温度。所以要确保安装了lm_sensors软件并正确配置你的系统。要更多了解关于lm_sensors的内容,查看下面的指南。
- How To View CPU Temperature On Linux
11. 显示进程信息
要显示小号CPU和内存最多的top 5进程,简单地运行下面命令即可:
$ inxi -tProcesses: 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 RAM: 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 mProcesses: System RAM: 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的使用来排序top 5进程,运行:
$ inxi -t cProcesses: 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个进程。你可以向下面这样改变进程的数量。
$ inxi -t cm10Processes: 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 RAM: 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和内存最多的top 10进程。
要仅仅显示使用内存最多的top 10进程,运行:
$ inxi -t m10
12. 显示分区UUID信息
要显示分区的UUIDs(Universally Unique Identifier),使用-u选项。
$ inxi -u
还有许多的选项没有谈及,但是这些已经可以让你得到足够的关于你的Linux系统的信息了。
要知道更多细节和选项,参考工具的man页面。
$ man inxi
Inxi工具的主要目的是在IRC或者论坛帮助中进行使用。如果你想通过某个论坛或者站点寻找帮助,而某个人需要你提供你的系统的信息,你可以运行该命令,然后将其粘贴/复制上去就可以了。