这篇文章上次修改于 2002 天前,可能其部分内容已经发生变化,如有疑问可询问作者。 Inxi 最初是为控制台和 IRC(网络中继聊天)开发的一个强大且优秀的命令行系统信息脚本。可以使用它获取用户的硬件和系统信息,它也用于调试或者社区技术支持工具。 使用 Inxi 可以很容易的获取所有的硬件信息:硬盘、声卡、显卡、网卡、CPU 和 RAM 等。同时也能够获取大量的操作系统信息,比如硬件驱动、Xorg 、桌面环境、内核、GCC 版本,进程,开机时间和内存等信息。 大多数主流 Linux 发行版的仓库中都有 Inxi ,包括大多数 BSD 系统。部分系统已经默认安装有inxi ```bash $ sudo apt-get install --no-install-recommends inxi [On Debian/Ubuntu/Linux Mint] $ sudo yum install inxi [On CentOs/RHEL/Fedora] $ sudo dnf install inxi [On Fedora 22+] ``` 在使用 Inxi 之前,用下面的命令查看 Inxi 所有依赖和推荐的应用,以及各种目录,并显示需要安装哪些包来支持给定的功能。 ```bash $ inxi --recommends ``` inxi将输出自检信息 ```bash inxi will now begin checking for the programs it needs to operate. First a check of the main languages and tools inxi uses. Python is only for debugging data collection. --------------------------------------------------------------------------- Bash version: 4.3.42(1)-release Gawk version: 4.1.3, Sed version: Sudo version: 1.8.16 Python version: 2.7.12 --------------------------------------------------------------------------- Test One: Required System Directories (Linux Only). If one of these system directories is missing, inxi cannot operate: /proc....................................................................... Present /sys........................................................................ Present All the directories are present. --------------------------------------------------------------------------- Test Two: Required Core Applications. If one of these applications is missing, inxi cannot operate: df (info: partition data)................................................... /bin/df gawk (info: core tool)...................................................... /usr/bin/gawk grep (info: string search).................................................. /bin/grep lspci (info: hardware data)................................................. /usr/bin/lspci ps (info: process data)..................................................... /bin/ps readlink.................................................................... /bin/readlink sed (info: string replace).................................................. /bin/sed tr (info: character replace)................................................ /usr/bin/tr uname (info: kernel data)................................................... /bin/uname wc (info: word character count)............................................. /usr/bin/wc All the applications are present. --------------------------------------------------------------------------- Test Three: Script Recommends for Graphics Features. NOTE: If you do not use X these do not matter (like a headless server). Otherwise, if one of these applications is missing, inxi will have incomplete output: glxinfo (info: -G glx info)................................................. /usr/bin/glxinfo xdpyinfo (info: -G multi screen resolution)................................. /usr/bin/xdpyinfo xprop (info: -S desktop data)............................................... /usr/bin/xprop xrandr (info: -G single screen resolution).................................. /usr/bin/xrandr All the applications are present. --------------------------------------------------------------------------- Test Four: Script Recommends for Remaining Features. If one of these applications is missing, inxi will have incomplete output: dig (info: -i first wlan ip default test)................................... /usr/bin/dig dmidecode (info: -M if no sys machine data; -m memory)...................... /usr/sbin/dmidecode file (info: -o unmounted file system)....................................... /usr/bin/file hciconfig (info: -n -i bluetooth data)...................................... /bin/hciconfig hddtemp (info: -Dx show hdd temp)........................................... /usr/sbin/hddtemp ifconfig (info: -i ip lan-deprecated)....................................... /sbin/ifconfig ip (info: -i ip lan)........................................................ /sbin/ip sensors (info: -s sensors output)........................................... /usr/bin/sensors strings (info: -I sysvinit version)......................................... /usr/bin/strings lsusb (info: -A usb audio;-N usb networking)................................ /usr/bin/lsusb modinfo (info: -Ax,-Nx module version)...................................... /sbin/modinfo runlevel (info: -I runlevel)................................................ /sbin/runlevel sudo (info: -Dx hddtemp-user;-o file-user).................................. /usr/bin/sudo uptime (info: -I uptime (check which package owns Debian)).................. /usr/bin/uptime All the applications are present. --------------------------------------------------------------------------- Test Five: Script Recommends for Remaining Features. One of these downloaders needed for options -i/-w/-W (-U/-! [11-15], if supported): wget (info: -i wan ip;-w/-W;-U/-! [11-15] (if supported))................... /usr/bin/wget curl (info: -i wan ip;-w/-W;-U/-! [11-15] (if supported))................... /usr/bin/curl All the applications are present. --------------------------------------------------------------------------- Test Six: System Directories for Various Information. (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)........................ Present All the directories are present. --------------------------------------------------------------------------- Test Seven: System Files for Various Information. (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).................. Present The following files are missing from your system: File: /var/run/dmesg.boot --------------------------------------------------------------------------- All tests completed. ``` ## Inxi 工具的基本用法 ### 获取 Linux 系统信息 Inix 不加任何选项就能输出下面的信息:CPU 、内核、开机时长、内存大小、硬盘大小、进程数、登录终端以及 Inxi 版本。 ```bash $ inxi CPU~Dual core Intel Core i5-4210U (-HT-MCP-) speed/max~2164/2700 MHz Kernel~4.4.0-21-generic x86_64 Up~3:15 Mem~3122.0/7879.9MB HDD~1000.2GB(20.0% used) Procs~234 Client~Shell inxi~2.2.35 ``` ### 获取内核和发行版本信息 使用 Inxi 的 -S 选项查看本机系统信息(主机名、内核信息、桌面环境和发行版): ```bash $ inxi -S System: Host: TecMint Kernel: 4.4.0-21-generic x86_64 (64 bit) Desktop: Cinnamon 3.0.7 Distro: Linux Mint 18 Sarah ``` ### 获取电脑机型 使用 -M 选项查看机型(笔记本/台式机)、产品 ID 、机器版本、主板、制造商和 BIOS 等信息: ```bash $ inxi -M Machine: System: LENOVO (portable) product: 20354 v: Lenovo Z50-70 Mobo: LENOVO model: Lancer 5A5 v: 31900059WIN Bios: LENOVO v: 9BCN26WW date: 07/31/2014 ``` ### 获取 CPU 及主频信息 使用 -C 选项查看完整的 CPU 信息,包括每核 CPU 的频率及可用的最大主频。 ```bash $ inxi -C CPU: Dual core Intel Core i5-4210U (-HT-MCP-) cache: 3072 KB clock speeds: max: 2700 MHz 1: 1942 MHz 2: 1968 MHz 3: 1734 MHz 4: 1710 MHz ``` ### 获取显卡信息 使用 -G 选项查看显卡信息,包括显卡类型、显示服务器、系统分辨率、GLX 渲染器和 GLX 版本等等(LCTT 译注: GLX 是一个 X 窗口系统的 OpenGL 扩展)。 ```bash $ inxi -G Graphics: Card-1: Intel Haswell-ULT Integrated Graphics Controller Card-2: NVIDIA GM108M [GeForce 840M] Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.05hz GLX Renderer: Mesa DRI Intel Haswell Mobile GLX Version: 3.0 Mesa 11.2.0 ``` ### 获取声卡信息 使用 -A 选项查看声卡信息: ```bash $ inxi -A Audio: Card-1 Intel 8 Series HD Audio Controller driver: snd_hda_intel Sound: ALSA v: k4.4.0-21-generic Card-2 Intel Haswell-ULT HD Audio Controller driver: snd_hda_intel ``` ### 获取网卡信息 使用 -N 选项查看网卡信息: ```bash $ inxi -N Network: Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller driver: r8169 Card-2: Realtek RTL8723BE PCIe Wireless Network Adapter driver: rtl8723be ``` ### 获取硬盘信息 使用 -D 选项查看硬盘信息(大小、ID、型号): ```bash $ inxi -D Drives: HDD Total Size: 1000.2GB (20.0% used) ID-1: /dev/sda model: ST1000LM024_HN size: 1000.2GB ``` ### 获取简要的系统信息 使用 -b 选项显示上述信息的简要系统信息: ```bash $ inxi -b System: Host: TecMint Kernel: 4.4.0-21-generic x86_64 (64 bit) Desktop: Cinnamon 3.0.7 Distro: Linux Mint 18 Sarah Machine: System: LENOVO (portable) product: 20354 v: Lenovo Z50-70 Mobo: LENOVO model: Lancer 5A5 v: 31900059WIN Bios: LENOVO v: 9BCN26WW date: 07/31/2014 CPU: Dual core Intel Core i5-4210U (-HT-MCP-) speed/max: 2018/2700 MHz Graphics: Card-1: Intel Haswell-ULT Integrated Graphics Controller Card-2: NVIDIA GM108M [GeForce 840M] Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.05hz GLX Renderer: Mesa DRI Intel Haswell Mobile GLX Version: 3.0 Mesa 11.2.0 Network: Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller driver: r8169 Card-2: Realtek RTL8723BE PCIe Wireless Network Adapter driver: rtl8723be Drives: HDD Total Size: 1000.2GB (20.0% used) Info: Processes: 233 Uptime: 3:23 Memory: 3137.5/7879.9MB Client: Shell (bash) inxi: 2.2.35 ``` ### 获取硬盘分区信息 使用 -p 选项输出完整的硬盘分区信息,包括每个分区的分区大小、已用空间、可用空间、文件系统以及文件系统类型。 ```bash $ inxi -p Partition: ID-1: / size: 324G used: 183G (60%) fs: ext4 dev: /dev/sda10 ID-2: swap-1 size: 4.00GB used: 0.00GB (0%) fs: swap dev: /dev/sda9 ``` ### 获取完整的 Linux 系统信息 使用 -F 选项查看可以完整的 Inxi 输出(安全起见比如网络 IP 地址信息没有显示,下面的示例只显示部分输出信息): ```bash $ inxi -F System: Host: TecMint Kernel: 4.4.0-21-generic x86_64 (64 bit) Desktop: Cinnamon 3.0.7 Distro: Linux Mint 18 Sarah Machine: System: LENOVO (portable) product: 20354 v: Lenovo Z50-70 Mobo: LENOVO model: Lancer 5A5 v: 31900059WIN Bios: LENOVO v: 9BCN26WW date: 07/31/2014 CPU: Dual core Intel Core i5-4210U (-HT-MCP-) cache: 3072 KB clock speeds: max: 2700 MHz 1: 1716 MHz 2: 1764 MHz 3: 1776 MHz 4: 1800 MHz Graphics: Card-1: Intel Haswell-ULT Integrated Graphics Controller Card-2: NVIDIA GM108M [GeForce 840M] Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.05hz GLX Renderer: Mesa DRI Intel Haswell Mobile GLX Version: 3.0 Mesa 11.2.0 Audio: Card-1 Intel 8 Series HD Audio Controller driver: snd_hda_intel Sound: ALSA v: k4.4.0-21-generic Card-2 Intel Haswell-ULT HD Audio Controller driver: snd_hda_intel Network: Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller driver: r8169 IF: enp1s0 state: up speed: 100 Mbps duplex: full mac: 28:d2:44:eb:bd:98 Card-2: Realtek RTL8723BE PCIe Wireless Network Adapter driver: rtl8723be IF: wlp2s0 state: down mac: 38:b1:db:7c:78:c7 Drives: HDD Total Size: 1000.2GB (20.0% used) ID-1: /dev/sda model: ST1000LM024_HN size: 1000.2GB Partition: ID-1: / size: 324G used: 183G (60%) fs: ext4 dev: /dev/sda10 ID-2: swap-1 size: 4.00GB used: 0.00GB (0%) fs: swap dev: /dev/sda9 RAID: No RAID devices: /proc/mdstat, md_mod kernel module present Sensors: System Temperatures: cpu: 56.0C mobo: N/A Fan Speeds (in rpm): cpu: N/A Info: Processes: 234 Uptime: 3:26 Memory: 3188.9/7879.9MB Client: Shell (bash) inxi: 2.2.35 ``` ## 使用 Inxi 工具监控 Linux 系统 ### 监控进程占用的 CPU 和内存资源 Inxi 默认显示 前 5 个最消耗 CPU 和内存的进程。 -t 选项和 c 选项一起使用查看前 5 个最消耗 CPU 资源的进程,查看最消耗内存的进程使用 -t 选项和 m 选项; -t选项 和 cm 选项一起使用显示前 5 个最消耗 CPU 和内存资源的进程。 ```bash renothing@desktop:~[master]$ inxi -tc Processes: CPU: % used - top 5 active 1: cpu: 26.2% command: c:\Program (started by: c:\Program) pid: 25512 2: cpu: 14.8% command: chrome pid: 13270 3: cpu: 14.3% command: wineserver.real pid: 25304 4: cpu: 12.6% command: chrome pid: 13235 5: cpu: 9.7% command: chrome pid: 19067 renothing@desktop:~[master]$ inxi -tc10 Processes: CPU: % used - top 10 active 1: cpu: 26.5% command: c:\Program (started by: c:\Program) pid: 25512 2: cpu: 14.7% command: chrome pid: 13270 3: cpu: 14.2% command: wineserver.real pid: 25304 4: cpu: 12.5% command: chrome pid: 13235 5: cpu: 9.7% command: chrome pid: 19067 6: cpu: 8.9% command: cinnamon pid: 13119 7: cpu: 8.8% command: Xorg pid: 1050 8: cpu: 6.5% command: chrome pid: 19815 9: cpu: 5.1% command: chrome pid: 19859 10: cpu: 1.7% command: chrome pid: 13275 renothing@desktop:~[master]$ inxi -tm10 Processes: Memory: MB / % used - Used/Total: 1744.0/3857.2MB - top 10 active 1: mem: 319.56MB (8.2%) command: chrome pid: 13235 2: mem: 223.46MB (5.7%) command: c:\Program (started by: c:\Program) pid: 25512 3: mem: 179.81MB (4.6%) command: chrome pid: 19067 4: mem: 176.20MB (4.5%) command: cinnamon pid: 13119 5: mem: 164.91MB (4.2%) command: chrome pid: 19859 6: mem: 137.64MB (3.5%) command: chrome pid: 19815 7: mem: 128.70MB (3.3%) command: chrome pid: 19963 8: mem: 127.00MB (3.2%) command: chrome pid: 13270 9: mem: 120.09MB (3.1%) command: chrome pid: 13504 10: mem: 116.57MB (3.0%) command: chrome pid: 19004 ``` 同时显示内存和cpu前10 ```bash renothing@desktop:~[master]$ inxi -tcm10 Processes: CPU: % used - top 10 active 1: cpu: 27.0% command: c:\Program (started by: c:\Program) pid: 25512 2: cpu: 14.5% command: chrome pid: 13270 3: cpu: 14.1% command: wineserver.real pid: 25304 4: cpu: 12.3% command: chrome pid: 13235 5: cpu: 9.7% command: chrome pid: 19067 6: cpu: 9.0% command: cinnamon pid: 13119 7: cpu: 8.7% command: Xorg pid: 1050 8: cpu: 6.3% command: chrome pid: 19815 9: cpu: 5.1% command: chrome pid: 19859 10: cpu: 1.6% command: chrome pid: 13275 Memory: MB / % used - Used/Total: 1753.5/3857.2MB - top 10 active 1: mem: 319.58MB (8.2%) command: chrome pid: 13235 2: mem: 223.46MB (5.7%) command: c:\Program (started by: c:\Program) pid: 25512 3: mem: 179.56MB (4.6%) command: chrome pid: 19067 4: mem: 176.20MB (4.5%) command: cinnamon pid: 13119 5: mem: 165.80MB (4.2%) command: chrome pid: 19859 6: mem: 145.34MB (3.7%) command: chrome pid: 19815 7: mem: 128.70MB (3.3%) command: chrome pid: 19963 8: mem: 127.51MB (3.3%) command: chrome pid: 13270 9: mem: 120.09MB (3.1%) command: chrome pid: 13504 10: mem: 116.57MB (3.0%) command: chrome pid: 19004 ``` ### 监控网络设备 ```bash $ inxi -Nni Network: Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller driver: r8169 IF: enp1s0 state: up speed: 100 Mbps duplex: full mac: 28:d2:44:eb:bd:98 Card-2: Realtek RTL8723BE PCIe Wireless Network Adapter driver: rtl8723be IF: wlp2s0 state: down mac: 38:b1:db:7c:78:c7 WAN IP: 111.91.115.195 IF: wlp2s0 ip-v4: N/A IF: enp1s0 ip-v4: 192.168.0.103 ``` ### 监控 CPU 温度和电脑风扇转速 ```bash $ inxi -s Sensors: System Temperatures: cpu: 53.0C mobo: N/A Fan Speeds (in rpm): cpu: N/A ``` ### 查看所有的 Linux 仓库信息 ```bash $ inxi -r Repos: Active apt sources in file: /etc/apt/sources.list.d/dawidd0811-neofetch-xenial.list deb http://ppa.launchpad.net/dawidd0811/neofetch/ubuntu xenial main deb-src http://ppa.launchpad.net/dawidd0811/neofetch/ubuntu xenial main Active apt sources in file: /etc/apt/sources.list.d/dhor-myway-xenial.list deb http://ppa.launchpad.net/dhor/myway/ubuntu xenial main deb-src http://ppa.launchpad.net/dhor/myway/ubuntu xenial main Active apt sources in file: /etc/apt/sources.list.d/official-package-repositories.list deb http://packages.linuxmint.com sarah main upstream import backport deb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse deb http://archive.canonical.com/ubuntu/ xenial partner Active apt sources in file: /etc/apt/sources.list.d/qbittorrent-team-qbittorrent-stable-xenial.list deb http://ppa.launchpad.net/qbittorrent-team/qbittorrent-stable/ubuntu xenial main deb-src http://ppa.launchpad.net/qbittorrent-team/qbittorrent-stable/ubuntu xenial main Active apt sources in file: /etc/apt/sources.list.d/slgobinath-safeeyes-xenial.list deb http://ppa.launchpad.net/slgobinath/safeeyes/ubuntu xenial main deb-src http://ppa.launchpad.net/slgobinath/safeeyes/ubuntu xenial main Active apt sources in file: /etc/apt/sources.list.d/snwh-pulp-xenial.list deb http://ppa.launchpad.net/snwh/pulp/ubuntu xenial main deb-src http://ppa.launchpad.net/snwh/pulp/ubuntu xenial main Active apt sources in file: /etc/apt/sources.list.d/twodopeshaggy-jarun-xenial.list deb http://ppa.launchpad.net/twodopeshaggy/jarun/ubuntu xenial main deb-src http://ppa.launchpad.net/twodopeshaggy/jarun/ubuntu xenial main Active apt sources in file: /etc/apt/sources.list.d/ubuntu-mozilla-security-ppa-xenial.list deb http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu xenial main deb-src http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu xenial main ``` 转自:http://www.tecmint.com/inxi-command-to-find-linux-system-information/
没有评论