2021-05-12 14:32:11
Inxi:一個功能強大的獲取 Linux 系統資訊的命令列工具
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 tools
inxi uses.Pythonis 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
---------------------------------------------------------------------------
TestOne:RequiredSystemDirectories(LinuxOnly).
If one of these system directories is missing, inxi cannot operate:
/proc.......................................................................Present
/sys........................................................................Present
All the directories are present.
---------------------------------------------------------------------------
TestTwo:RequiredCoreApplications.
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.
---------------------------------------------------------------------------
TestThree:ScriptRecommendsforGraphicsFeatures.
NOTE:If you donotuse X these donot 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.
---------------------------------------------------------------------------
TestFour:ScriptRecommendsforRemainingFeatures.
If one of these applications is missing, inxi will have incomplete output:
dig (info:-i first wlan ipdefaulttest).................................../usr/bin/dig
dmidecode (info:-M ifno 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,-Nxmodule 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.
---------------------------------------------------------------------------
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/-![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.
---------------------------------------------------------------------------
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)........................Present
All 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)..................Present
The following files are missing from your system:
File:/var/run/dmesg.boot
---------------------------------------------------------------------------
All tests completed.
Inxi 工具的基本用法
用下面的基本用法獲取系統和硬體的詳細資訊。
獲取 Linux 系統資訊
Inix 不加任何選項就能輸出下面的資訊:CPU 、核心、開機時長、記憶體大小、硬碟大小、進程數、登入終端以及 Inxi 版本。
$ inxi
CPU~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 -S
System:Host:TecMintKernel:4.4.0-21-generic x86_64 (64 bit)Desktop:Cinnamon3.0.7
Distro:LinuxMint18Sarah
獲取電腦機型
使用 -M
選項檢視機型(筆電/桌上型電腦)、產品 ID 、機器版本、主機板、製造商和 BIOS 等資訊:
$ inxi -M
Machine:System: LENOVO (portable) product:20354 v:Lenovo Z50-70
Mobo: LENOVO model:Lancer5A5 v:31900059WINBios: LENOVO v:9BCN26WWdate:07/31/2014
獲取 CPU 及主頻資訊
使用 -C
選項檢視完整的 CPU 資訊,包括每核 CPU 的頻率及可用的最大主頻。
$ inxi -C
CPU:Dual core IntelCore i5-4210U(-HT-MCP-) cache:3072 KB
clock speeds: max:2700MHz1:1942MHz2:1968MHz3:1734MHz4:1710MHz
獲取顯示卡資訊
使用 -G
選項檢視顯示卡資訊,包括顯示卡型別、顯示伺服器、系統解析度、GLX 渲染器和 GLX 版本等等(LCTT 譯註: GLX 是一個 X 視窗系統的 OpenGL 擴充套件)。
$ inxi -G
Graphics:Card-1:IntelHaswell-ULT IntegratedGraphicsController
Card-2: NVIDIA GM108M [GeForce840M]
DisplayServer: X.Org1.18.4 drivers: intel (unloaded: fbdev,vesa)Resolution:1920x1080@60.05hz
GLX Renderer:Mesa DRI IntelHaswellMobile GLX Version:3.0Mesa11.2.0
獲取音效卡資訊
使用 -A
選項檢視音效卡資訊:
$ inxi -A
Audio:Card-1Intel8Series HD AudioController driver: snd_hda_intel Sound: ALSA v: k4.4.0-21-generic
Card-2IntelHaswell-ULT HD AudioController driver: snd_hda_intel
獲取網絡卡資訊
使用 -N
選項檢視網絡卡資訊:
$ inxi -N
Network:Card-1:Realtek RTL8111/8168/8411 PCI ExpressGigabitEthernetController driver: r8169
Card-2:Realtek RTL8723BE PCIeWirelessNetworkAdapter driver: rtl8723be
獲取硬碟資訊
使用 -D
選項檢視硬碟資訊(大小、ID、型號):
$ inxi -D
Drives: HDD TotalSize:1000.2GB(20.0% used) ID-1:/dev/sda model: ST1000LM024_HN size:1000.2GB
獲取簡要的系統資訊
使用 -b
選項顯示上述資訊的簡要系統資訊:
$ inxi -b
System:Host:TecMintKernel:4.4.0-21-generic x86_64 (64 bit)Desktop:Cinnamon3.0.7
Distro:LinuxMint18Sarah
Machine:System: LENOVO (portable) product:20354 v:Lenovo Z50-70
Mobo: LENOVO model:Lancer5A5 v:31900059WINBios: LENOVO v:9BCN26WWdate:07/31/2014
CPU:Dual core IntelCore i5-4210U(-HT-MCP-) speed/max:2018/2700MHz
Graphics:Card-1:IntelHaswell-ULT IntegratedGraphicsController
Card-2: NVIDIA GM108M [GeForce840M]
DisplayServer: X.Org1.18.4 drivers: intel (unloaded: fbdev,vesa)Resolution:1920x1080@60.05hz
GLX Renderer:Mesa DRI IntelHaswellMobile GLX Version:3.0Mesa11.2.0
Network:Card-1:Realtek RTL8111/8168/8411 PCI ExpressGigabitEthernetController driver: r8169
Card-2:Realtek RTL8723BE PCIeWirelessNetworkAdapter driver: rtl8723be
Drives: HDD TotalSize:1000.2GB(20.0% used)
Info:Processes:233Uptime:3:23Memory:3137.5/7879.9MBClient:Shell(bash) inxi:2.2.35
獲取硬碟分割區資訊
使用 -p
選項輸出完整的硬碟分割區資訊,包括每個分割區的分割區大小、已用空間、可用空間、檔案系統以及檔案系統型別。
$ inxi -p
Partition: ID-1:/ size: 324G used: 183G (60%) fs: ext4 dev: /dev/sda10
ID-2: swap-1size:4.00GB used:0.00GB(0%) fs: swap dev:/dev/sda9
獲取完整的 Linux 系統資訊
使用 -F
選項檢視可以完整的 Inxi 輸出(安全起見比如網路 IP 地址資訊沒有顯示,下面的範例只顯示部分輸出資訊):
$ inxi -F
System:Host:TecMintKernel:4.4.0-21-generic x86_64 (64 bit)Desktop:Cinnamon3.0.7
Distro:LinuxMint18Sarah
Machine:System: LENOVO (portable) product:20354 v:Lenovo Z50-70
Mobo: LENOVO model:Lancer5A5 v:31900059WINBios: LENOVO v:9BCN26WWdate:07/31/2014
CPU:Dual core IntelCore i5-4210U(-HT-MCP-) cache:3072 KB
clock speeds: max:2700MHz1:1716MHz2:1764MHz3:1776MHz4:1800MHz
Graphics:Card-1:IntelHaswell-ULT IntegratedGraphicsController
Card-2: NVIDIA GM108M [GeForce840M]
DisplayServer: X.Org1.18.4 drivers: intel (unloaded: fbdev,vesa)Resolution:1920x1080@60.05hz
GLX Renderer:Mesa DRI IntelHaswellMobile GLX Version:3.0Mesa11.2.0
Audio:Card-1Intel8Series HD AudioController driver: snd_hda_intel Sound: ALSA v: k4.4.0-21-generic
Card-2IntelHaswell-ULT HD AudioController driver: snd_hda_intel
Network:Card-1:Realtek RTL8111/8168/8411 PCI ExpressGigabitEthernetController driver: r8169
IF: enp1s0 state: up speed:100Mbps duplex: full mac:28:d2:44:eb:bd:98
Card-2:Realtek RTL8723BE PCIeWirelessNetworkAdapter driver: rtl8723be
IF: wlp2s0 state: down mac:38:b1:db:7c:78:c7
Drives: HDD TotalSize: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-1size:4.00GB used:0.00GB(0%) fs: swap dev:/dev/sda9
RAID:No RAID devices:/proc/mdstat, md_mod kernel module present
Sensors:SystemTemperatures: cpu:56.0C mobo: N/A
FanSpeeds(in rpm): cpu: N/A
Info:Processes:234Uptime:3:26Memory:3188.9/7879.9MBClient:Shell(bash) inxi:2.2.35
使用 Inxi 工具監控 Linux 系統
下面是監控 Linux 系統進程、開機時間和記憶體的幾個選項的使用方法。
監控 Linux 進程的記憶體使用
使用下面的命令檢視進程數、開機時間和記憶體使用情況:
$ inxi -I
Info: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 c
Processes: CPU:% used -top5 active
1: cpu:53.7% command: plugin-container pid:3066
2: cpu:20.0% command: java pid:1527
3: cpu:19.7% command: firefox pid:3018
4: cpu:4.6% command:Xorg pid:2114
5: cpu:3.0% command: cinnamon pid:2835
-----------------LinuxMemoeryUsage-----------------
$ inxi -t m
Processes:Memory: MB /% used -Used/Total:3212.5/7879.9MB-top5 active
1: mem:980.51MB(12.4%) command: plugin-container pid:3066
2: mem:508.96MB(6.4%) command: java pid:1527
3: mem:507.89MB(6.4%) command: firefox pid:3018
4: mem:244.05MB(3.0%) command: chrome pid:7405
5: mem:211.46MB(2.6%) command: chrome pid:6146
-----------------Linux CPU andMemoryUsage-----------------
$ inxi -t cm
Processes: CPU:% used -top5 active
1: cpu:53.7% command: plugin-container pid:3066
2: cpu:20.0% command: java pid:1527
3: cpu:19.7% command: firefox pid:3018
4: cpu:4.6% command:Xorg pid:2114
5: cpu:3.0% command: cinnamon pid:2835
Memory: MB /% used -Used/Total:3223.6/7879.9MB-top5 active
1: mem:991.93MB(12.5%) command: plugin-container pid:3066
2: mem:508.96MB(6.4%) command: java pid:1527
3: mem:507.86MB(6.4%) command: firefox pid:3018
4: mem:244.45MB(3.1%) command: chrome pid:7405
5: mem:211.68MB(2.6%) command: chrome pid:6146
可以在選項 cm
後跟一個整數(在 1-20 之間)設定顯示多少個進程,下面的命令顯示了前 10 個最消耗 CPU 和記憶體的進程:
$ inxi -t cm10
Processes: CPU:% used -top10 active
1: cpu:53.4% command: plugin-container pid:3066
2: cpu:19.8% command: java pid:1527
3: cpu:19.5% command: firefox pid:3018
4: cpu:4.5% command:Xorg pid:2114
5: cpu:3.0% command: cinnamon pid:2835
6: cpu:2.8% command: chrome pid:7405
7: cpu:1.1% command: pulseaudio pid:2733
8: cpu:1.0% command: soffice.bin pid:7799
9: cpu:0.9% command: chrome pid:5763
10: cpu:0.5% command: chrome pid:6179
Memory: MB /% used -Used/Total:3163.1/7879.9MB-top10 active
1: mem:976.82MB(12.3%) command: plugin-container pid:3066
2: mem:511.70MB(6.4%) command: java pid:1527
3: mem:466.01MB(5.9%) command: firefox pid:3018
4: mem:244.40MB(3.1%) command: chrome pid:7405
5: mem:203.71MB(2.5%) command: chrome pid:6146
6: mem:199.74MB(2.5%) command: chrome pid:5763
7: mem:168.30MB(2.1%) command: cinnamon pid:2835
8: mem:165.51MB(2.1%) command: soffice.bin pid:7799
9: mem:158.91MB(2.0%) command: chrome pid:6179
10: mem:151.83MB(1.9%) command: mysqld pid:1259
監控網路裝置
下面的命令會列出網絡卡資訊,包括介面資訊、網路頻率、mac 地址、網絡卡狀態和網路 IP 等資訊。
$ inxi -Nni
Network:Card-1:Realtek RTL8111/8168/8411 PCI ExpressGigabitEthernetController driver: r8169
IF: enp1s0 state: up speed:100Mbps duplex: full mac:28:d2:44:eb:bd:98
Card-2:Realtek RTL8723BE PCIeWirelessNetworkAdapter 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 溫度和電腦風扇轉速
可以使用 -s
選項監控 設定了感測器的機器 獲取溫度和風扇轉速:
$ inxi -s
Sensors:SystemTemperatures: cpu:53.0C mobo: N/A
FanSpeeds(in rpm): cpu: N/A
用 Linux 檢視天氣預報
使用 -w
選項檢視本地區的天氣情況(雖然使用的 API 可能不是很可靠),使用 -W <different_location>
設定另外的地區。
$ inxi -w
Weather:Conditions:93 F (34 C)- smoke Time:February20,1:38 PM IST
$ inxi -W Mumbai,India
Weather:Conditions:93 F (34 C)- smoke Time:February20,1:38 PM IST
$ inxi -W Nairobi,Kenya
Weather:Conditions:70 F (21 C)-MostlyCloudyTime:February20,11:08 AM EAT
檢視所有的 Linux 倉庫資訊
另外,可以使用 -r
選項檢視一個 Linux 發行版的倉庫資訊:
$ inxi -r
Repos:Active apt sources infile:/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 infile:/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 infile:/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 infile:/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 infile:/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 infile:/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 infile:/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 infile:/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
下面是檢視 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
相關文章