Inxi 最初是为控制台和 IRC(网络中继聊天)开发的一个强大且优秀的命令行系统信息脚本。可以使用它获取用户的硬件和系统信息,它也用于调试或者社区技术支持工具。
使用 Inxi 可以很容易的获取所有的硬件信息:硬盘、声卡、显卡、网卡、CPU 和 RAM 等。同时也能够获取大量的操作系统信息,比如硬件驱动、Xorg 、桌面环境、内核、GCC 版本,进程,开机时间和内存等信息。
运行在命令行和 IRC 上的 Inxi 输出略有不同,IRC 上会有一些可供用户使用的默认过滤器和颜色选项。支持的 IRC 客户端有:BitchX、Gaim/Pidgin、ircII、Irssi、 Konversation、 Kopete、 KSirc、 KVIrc、 Weechat 和 Xchat 以及其它的一些客户端,它们具有展示内置或外部 Inxi 输出的能力。
在 Linux 系统上安装 Inxi
大多数主流 Linux 发行版的仓库中都有 Inxi ,包括大多数 BSD 系统。
$ sudoapt-get install inxi [OnDebian/Ubuntu/LinuxMint]$ sudoyum install inxi [OnCentOS/RHEL/Fedora]$ sudo dnf install inxi [OnFedora22+]
在使用 Inxi 之前,用下面的命令查看 Inxi 所有依赖和推荐的应用,以及各种目录,并显示需要安装哪些包来支持给定的功能。
$ inxi --recommends
Inxi 的输出:
inxi will now begin checking for the programs it needs to operate.First a check of the main languages and toolsinxi uses.Pythonis only for debugging data collection.---------------------------------------------------------------------------Bash version:4.3.42(1)-releaseGawk version:4.1.3,Sed version:Sudo version:1.8.16Python version:2.7.12---------------------------------------------------------------------------TestOne:RequiredSystemDirectories(LinuxOnly).If one of these system directories is missing, inxi cannot operate:/proc.......................................................................Present/sys........................................................................PresentAll the directories are present.---------------------------------------------------------------------------TestTwo:RequiredCoreApplications.If one of these applications is missing, inxi cannot operate:df(info: partition data).................................................../bin/dfgawk(info: core tool)....................................................../usr/bin/gawkgrep(info: string search)................................................../bin/greplspci (info: hardware data)................................................./usr/bin/lspcips(info: process data)...................................................../bin/psreadlink..................................................................../bin/readlinksed(info: string replace)................................................../bin/sedtr(info: character replace)................................................/usr/bin/truname(info: kernel data).................................................../bin/unamewc(info: word character count)............................................./usr/bin/wcAll the applications are present.---------------------------------------------------------------------------TestThree:ScriptRecommendsforGraphicsFeatures.NOTE:If you donotuse X these donot matter (like a headless server).Otherwise,if one of these applicationsis missing, inxi will have incomplete output:glxinfo (info:-G glx info)................................................./usr/bin/glxinfoxdpyinfo (info:-G multi screen resolution)................................./usr/bin/xdpyinfoxprop (info:-S desktop data).............................................../usr/bin/xpropxrandr (info:-G single screen resolution)................................../usr/bin/xrandrAll the applications are present.---------------------------------------------------------------------------TestFour:ScriptRecommendsforRemainingFeatures.If one of these applications is missing, inxi will have incomplete output:dig (info:-i first wlan ipdefaulttest).................................../usr/bin/digdmidecode (info:-M ifno sys machine data;-m memory)....................../usr/sbin/dmidecodefile(info:-o unmounted file system)......................................./usr/bin/filehciconfig (info:-n -i bluetooth data)....................................../bin/hciconfighddtemp (info:-Dx show hdd temp).........................................../usr/sbin/hddtempifconfig(info:-i ip lan-deprecated)......................................./sbin/ifconfigip(info:-i ip lan)......................................................../sbin/ipsensors (info:-s sensors output).........................................../usr/bin/sensorsstrings(info:-I sysvinit version)........................................./usr/bin/stringslsusb (info:-A usb audio;-N usb networking)................................/usr/bin/lsusbmodinfo (info:-Ax,-Nxmodule version)....................................../sbin/modinforunlevel(info:-I runlevel)................................................/sbin/runlevelsudo(info:-Dx hddtemp-user;-o file-user)................................../usr/bin/sudouptime(info:-I uptime(check which package owns Debian))................../usr/bin/uptimeAll the applications are present.---------------------------------------------------------------------------TestFive:ScriptRecommendsforRemainingFeatures.One of these downloaders needed for options -i/-w/-W (-U/-![11-15],if supported):wget(info:-i wan ip;-w/-W;-U/-).................../usr/bin/wgetcurl (info:-i wan ip;-w/-W;-U/-).................../usr/bin/curlAll the applications are present.---------------------------------------------------------------------------TestSix:SystemDirectoriesforVariousInformation.(Unless otherwise noted, these are for GNU/Linux systems)If one of these directories is missing, inxi may have incomplete output:/sys/class/dmi/id(info:-M system, motherboard, bios)......................Present/dev (info:-l,-u,-o,-p,-P,-D disk partition data)..........................Present/dev/disk/by-label (info:-l,-o,-p,-P partition labels).....................Present/dev/disk/by-uuid (info:-u,-o,-p,-P partition uuid)........................PresentAll the directories are present.---------------------------------------------------------------------------TestSeven:SystemFilesforVariousInformation.(Unless otherwise noted, these are for GNU/Linux systems)If one of these files is missing, inxi may have incomplete output:/proc/asound/cards (info:-A sound card data)...............................Present/proc/asound/version (info:-A ALSA data)...................................Present/proc/cpuinfo (info:-C cpu data)...........................................Present/etc/lsb-release (info:-S distro version data [deprecated])................Present/proc/mdstat (info:-R mdraid data).........................................Present/proc/meminfo (info:-I memory data)........................................Present/etc/os-release (info:-S distro version data)..............................Present/proc/partitions (info:-p,-P partitions data)..............................Present/proc/modules (info:-G module data)........................................Present/proc/mounts (info:-P,-p partition advanced data)..........................Present/var/run/dmesg.boot (info:-D,-d disk data [BSD only])......................Missing/proc/scsi/scsi (info:-D Advanced hard disk data [used rarely])............Present/var/log/Xorg.0.log(info:-G graphics driver load status)..................PresentThe following files are missing from your system:File:/var/run/dmesg.boot---------------------------------------------------------------------------All tests completed.
Inxi 工具的基本用法
用下面的基本用法获取系统和硬件的详细信息。
获取 Linux 系统信息
Inix 不加任何选项就能输出下面的信息:CPU 、内核、开机时长、内存大小、硬盘大小、进程数、登录终端以及 Inxi 版本。
$ inxiCPU~Dual core IntelCore i5-4210U(-HT-MCP-) speed/max~2164/2700MHzKernel~4.4.0-21-generic x86_64 Up~3:15Mem~3122.0/7879.9MB HDD~1000.2GB(20.0% used)Procs~234Client~Shell inxi~2.2.35
获取内核和发行版本信息
使用 Inxi 的 -S 选项查看本机系统信息(主机名、内核信息、桌面环境和发行版):
$ inxi -SSystem:Host:TecMintKernel:4.4.0-21-generic x86_64 (64 bit)Desktop:Cinnamon3.0.7Distro:LinuxMint18Sarah
获取电脑机型
使用 -M 选项查看机型(笔记本/台式机)、产品 ID 、机器版本、主板、制造商和 BIOS 等信息:
$ inxi -MMachine:System: LENOVO (portable) product:20354 v:Lenovo Z50-70Mobo: LENOVO model:Lancer5A5 v:31900059WINBios: LENOVO v:9BCN26WWdate:07/31/2014
获取 CPU 及主频信息
使用 -C 选项查看完整的 CPU 信息,包括每核 CPU 的频率及可用的最大主频。
$ inxi -CCPU:Dual core IntelCore i5-4210U(-HT-MCP-) cache:3072 KBclock speeds: max:2700MHz1:1942MHz2:1968MHz3:1734MHz4:1710MHz
获取显卡信息
使用 -G 选项查看显卡信息,包括显卡类型、显示服务器、系统分辨率、GLX 渲染器和 GLX 版本等等(LCTT 译注: GLX 是一个 X 窗口系统的 OpenGL 扩展)。
$ inxi -GGraphics:Card-1:IntelHaswell-ULT IntegratedGraphicsControllerCard-2: NVIDIA GM108M [GeForce840M]DisplayServer: X.Org1.18.4 drivers: intel (unloaded: fbdev,vesa)Resolution:1920x1080@60.05hzGLX Renderer:Mesa DRI IntelHaswellMobile GLX Version:3.0Mesa11.2.0
获取声卡信息
使用 -A 选项查看声卡信息:
$ inxi -AAudio:Card-1Intel8Series HD AudioController driver: snd_hda_intel Sound: ALSA v: k4.4.0-21-genericCard-2IntelHaswell-ULT HD AudioController driver: snd_hda_intel
获取网卡信息
使用 -N 选项查看网卡信息:
$ inxi -NNetwork:Card-1:Realtek RTL8111/8168/8411 PCI ExpressGigabitEthernetController driver: r8169Card-2:Realtek RTL8723BE PCIeWirelessNetworkAdapter driver: rtl8723be
获取硬盘信息
使用 -D 选项查看硬盘信息(大小、ID、型号):
$ inxi -DDrives: HDD TotalSize:1000.2GB(20.0% used) ID-1:/dev/sda model: ST1000LM024_HN size:1000.2GB
获取简要的系统信息
使用 -b 选项显示上述信息的简要系统信息:
$ inxi -bSystem:Host:TecMintKernel:4.4.0-21-generic x86_64 (64 bit)Desktop:Cinnamon3.0.7Distro:LinuxMint18SarahMachine:System: LENOVO (portable) product:20354 v:Lenovo Z50-70Mobo: LENOVO model:Lancer5A5 v:31900059WINBios: LENOVO v:9BCN26WWdate:07/31/2014CPU:Dual core IntelCore i5-4210U(-HT-MCP-) speed/max:2018/2700MHzGraphics:Card-1:IntelHaswell-ULT IntegratedGraphicsControllerCard-2: NVIDIA GM108M [GeForce840M]DisplayServer: X.Org1.18.4 drivers: intel (unloaded: fbdev,vesa)Resolution:1920x1080@60.05hzGLX Renderer:Mesa DRI IntelHaswellMobile GLX Version:3.0Mesa11.2.0Network:Card-1:Realtek RTL8111/8168/8411 PCI ExpressGigabitEthernetController driver: r8169Card-2:Realtek RTL8723BE PCIeWirelessNetworkAdapter driver: rtl8723beDrives: HDD TotalSize:1000.2GB(20.0% used)Info:Processes:233Uptime:3:23Memory:3137.5/7879.9MBClient:Shell(bash) inxi:2.2.35
获取硬盘分区信息
使用 -p 选项输出完整的硬盘分区信息,包括每个分区的分区大小、已用空间、可用空间、文件系统以及文件系统类型。
$ inxi -pPartition: ID-1:/ size: 324G used: 183G (60%) fs: ext4 dev: /dev/sda10ID-2: swap-1size:4.00GB used:0.00GB(0%) fs: swap dev:/dev/sda9
获取完整的 Linux 系统信息
使用 -F 选项查看可以完整的 Inxi 输出(安全起见比如网络 IP 地址信息没有显示,下面的示例只显示部分输出信息):
$ inxi -FSystem:Host:TecMintKernel:4.4.0-21-generic x86_64 (64 bit)Desktop:Cinnamon3.0.7Distro:LinuxMint18SarahMachine:System: LENOVO (portable) product:20354 v:Lenovo Z50-70Mobo: LENOVO model:Lancer5A5 v:31900059WINBios: LENOVO v:9BCN26WWdate:07/31/2014CPU:Dual core IntelCore i5-4210U(-HT-MCP-) cache:3072 KBclock speeds: max:2700MHz1:1716MHz2:1764MHz3:1776MHz4:1800MHzGraphics:Card-1:IntelHaswell-ULT IntegratedGraphicsControllerCard-2: NVIDIA GM108M [GeForce840M]DisplayServer: X.Org1.18.4 drivers: intel (unloaded: fbdev,vesa)Resolution:1920x1080@60.05hzGLX Renderer:Mesa DRI IntelHaswellMobile GLX Version:3.0Mesa11.2.0Audio:Card-1Intel8Series HD AudioController driver: snd_hda_intel Sound: ALSA v: k4.4.0-21-genericCard-2IntelHaswell-ULT HD AudioController driver: snd_hda_intelNetwork:Card-1:Realtek RTL8111/8168/8411 PCI ExpressGigabitEthernetController driver: r8169IF: enp1s0 state: up speed:100Mbps duplex: full mac:28:d2:44:eb:bd:98Card-2:Realtek RTL8723BE PCIeWirelessNetworkAdapter driver: rtl8723beIF: wlp2s0 state: down mac:38:b1:db:7c:78:c7Drives: HDD TotalSize:1000.2GB(20.0% used) ID-1:/dev/sda model: ST1000LM024_HN size:1000.2GBPartition: ID-1:/ size: 324G used: 183G (60%) fs: ext4 dev: /dev/sda10ID-2: swap-1size:4.00GB used:0.00GB(0%) fs: swap dev:/dev/sda9RAID:No RAID devices:/proc/mdstat, md_mod kernel module presentSensors:SystemTemperatures: cpu:56.0C mobo: N/AFanSpeeds(in rpm): cpu: N/AInfo:Processes:234Uptime:3:26Memory:3188.9/7879.9MBClient:Shell(bash) inxi:2.2.35
使用 Inxi 工具监控 Linux 系统
下面是监控 Linux 系统进程、开机时间和内存的几个选项的使用方法。
监控 Linux 进程的内存使用
使用下面的命令查看进程数、开机时间和内存使用情况:
$ inxi -IInfo:Processes:232Uptime:3:35Memory:3256.3/7879.9MBClient:Shell(bash) inxi:2.2.35
监控进程占用的 CPU 和内存资源
Inxi 默认显示 前 5 个最消耗 CPU 和内存的进程。 -t 选项和 c 选项一起使用查看前 5 个最消耗 CPU 资源的进程,查看最消耗内存的进程使用 -t 选项和 m 选项; -t选项 和 cm 选项一起使用显示前 5 个最消耗 CPU 和内存资源的进程。
-----------------Linux CPU Usage-----------------$ inxi -t cProcesses: CPU:% used -top5 active1: cpu:53.7% command: plugin-container pid:30662: cpu:20.0% command: java pid:15273: cpu:19.7% command: firefox pid:30184: cpu:4.6% command:Xorg pid:21145: cpu:3.0% command: cinnamon pid:2835
-----------------LinuxMemoeryUsage-----------------$ inxi -t mProcesses:Memory: MB /% used -Used/Total:3212.5/7879.9MB-top5 active1: mem:980.51MB(12.4%) command: plugin-container pid:30662: mem:508.96MB(6.4%) command: java pid:15273: mem:507.89MB(6.4%) command: firefox pid:30184: mem:244.05MB(3.0%) command: chrome pid:74055: mem:211.46MB(2.6%) command: chrome pid:6146
-----------------Linux CPU andMemoryUsage-----------------$ inxi -t cmProcesses: CPU:% used -top5 active1: cpu:53.7% command: plugin-container pid:30662: cpu:20.0% command: java pid:15273: cpu:19.7% command: firefox pid:30184: cpu:4.6% command:Xorg pid:21145: cpu:3.0% command: cinnamon pid:2835Memory: MB /% used -Used/Total:3223.6/7879.9MB-top5 active1: mem:991.93MB(12.5%) command: plugin-container pid:30662: mem:508.96MB(6.4%) command: java pid:15273: mem:507.86MB(6.4%) command: firefox pid:30184: mem:244.45MB(3.1%) command: chrome pid:74055: mem:211.68MB(2.6%) command: chrome pid:6146
可以在选项 cm 后跟一个整数(在 1-20 之间)设置显示多少个进程,下面的命令显示了前 10 个最消耗 CPU 和内存的进程:
$ inxi -t cm10Processes: CPU:% used -top10 active1: cpu:53.4% command: plugin-container pid:30662: cpu:19.8% command: java pid:15273: cpu:19.5% command: firefox pid:30184: cpu:4.5% command:Xorg pid:21145: cpu:3.0% command: cinnamon pid:28356: cpu:2.8% command: chrome pid:74057: cpu:1.1% command: pulseaudio pid:27338: cpu:1.0% command: soffice.bin pid:77999: cpu:0.9% command: chrome pid:576310: cpu:0.5% command: chrome pid:6179Memory: MB /% used -Used/Total:3163.1/7879.9MB-top10 active1: mem:976.82MB(12.3%) command: plugin-container pid:30662: mem:511.70MB(6.4%) command: java pid:15273: mem:466.01MB(5.9%) command: firefox pid:30184: mem:244.40MB(3.1%) command: chrome pid:74055: mem:203.71MB(2.5%) command: chrome pid:61466: mem:199.74MB(2.5%) command: chrome pid:57637: mem:168.30MB(2.1%) command: cinnamon pid:28358: mem:165.51MB(2.1%) command: soffice.bin pid:77999: mem:158.91MB(2.0%) command: chrome pid:617910: mem:151.83MB(1.9%) command: mysqld pid:1259
监控网络设备
下面的命令会列出网卡信息,包括接口信息、网络频率、mac 地址、网卡状态和网络 IP 等信息。
$ inxi -NniNetwork:Card-1:Realtek RTL8111/8168/8411 PCI ExpressGigabitEthernetController driver: r8169IF: enp1s0 state: up speed:100Mbps duplex: full mac:28:d2:44:eb:bd:98Card-2:Realtek RTL8723BE PCIeWirelessNetworkAdapter driver: rtl8723beIF: wlp2s0 state: down mac:38:b1:db:7c:78:c7WAN IP:111.91.115.195 IF: wlp2s0 ip-v4: N/AIF: enp1s0 ip-v4:192.168.0.103
监控 CPU 温度和电脑风扇转速
可以使用 -s 选项监控 配置了传感器的机器 获取温度和风扇转速:
$ inxi -sSensors:SystemTemperatures: cpu:53.0C mobo: N/AFanSpeeds(in rpm): cpu: N/A
用 Linux 查看天气预报
使用 -w 选项查看本地区的天气情况(虽然使用的 API 可能不是很可靠),使用 -W <different_location> 设置另外的地区。
$ inxi -wWeather:Conditions:93 F (34 C)- smoke Time:February20,1:38 PM IST$ inxi -W Mumbai,IndiaWeather:Conditions:93 F (34 C)- smoke Time:February20,1:38 PM IST$ inxi -W Nairobi,KenyaWeather:Conditions:70 F (21 C)-MostlyCloudyTime:February20,11:08 AM EAT
查看所有的 Linux 仓库信息
另外,可以使用 -r 选项查看一个 Linux 发行版的仓库信息:
$ inxi -rRepos:Active apt sources infile:/etc/apt/sources.list.d/dawidd0811-neofetch-xenial.listdeb http://ppa.launchpad.net/dawidd0811/neofetch/ubuntu xenial maindeb-src http://ppa.launchpad.net/dawidd0811/neofetch/ubuntu xenial mainActive apt sources infile:/etc/apt/sources.list.d/dhor-myway-xenial.listdeb http://ppa.launchpad.net/dhor/myway/ubuntu xenial maindeb-src http://ppa.launchpad.net/dhor/myway/ubuntu xenial mainActive apt sources infile:/etc/apt/sources.list.d/official-package-repositories.listdeb http://packages.linuxmint.com sarah main upstream import backportdeb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiversedeb http://security.ubuntu.com/ubuntu/ xenial-security main restricted universe multiversedeb http://archive.canonical.com/ubuntu/ xenial partnerActive apt sources infile:/etc/apt/sources.list.d/qbittorrent-team-qbittorrent-stable-xenial.listdeb http://ppa.launchpad.net/qbittorrent-team/qbittorrent-stable/ubuntu xenial maindeb-src http://ppa.launchpad.net/qbittorrent-team/qbittorrent-stable/ubuntu xenial mainActive apt sources infile:/etc/apt/sources.list.d/slgobinath-safeeyes-xenial.listdeb http://ppa.launchpad.net/slgobinath/safeeyes/ubuntu xenial maindeb-src http://ppa.launchpad.net/slgobinath/safeeyes/ubuntu xenial mainActive apt sources infile:/etc/apt/sources.list.d/snwh-pulp-xenial.listdeb http://ppa.launchpad.net/snwh/pulp/ubuntu xenial maindeb-src http://ppa.launchpad.net/snwh/pulp/ubuntu xenial mainActive apt sources infile:/etc/apt/sources.list.d/twodopeshaggy-jarun-xenial.listdeb http://ppa.launchpad.net/twodopeshaggy/jarun/ubuntu xenial maindeb-src http://ppa.launchpad.net/twodopeshaggy/jarun/ubuntu xenial mainActive apt sources infile:/etc/apt/sources.list.d/ubuntu-mozilla-security-ppa-xenial.listdeb http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu xenial maindeb-src http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu xenial main
下面是查看 Inxi 的安装版本、快速帮助和打开 man 主页的方法,以及更多的 Inxi 使用细节。
$ inxi -v #显示版本信息$ inxi -h #快速帮助$ man inxi #打开man主页
浏览 Inxi 的官方 GitHub 主页 https://github.com/smxi/inxi 查看更多的信息。
Inxi 是一个功能强大的获取硬件和系统信息的命令行工具。这也是我使用过的最好的 获取硬件和系统信息的命令行工具 之一。
写下你的评论。如果你知道其他的像 Inxi 这样的工具,我们很高兴和你一起讨论。
作者简介:
Aaron Kili 是一个 Linux 和 F.O.S.S 的狂热爱好者,即任的 Linux 系统管理员,web 开发者,TecMint 网站的专栏作者,他喜欢使用计算机工作,并且乐于分享计算机技术。
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-04/143117.htm
服务器评测





