987
技術社區[雲棲]
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 係統。
$ sudo apt-get install inxi [On Debian/Ubuntu/Linux Mint]$ sudo yum install inxi [On CentOs/RHEL/Fedora]$ sudo dnf install inxi [On Fedora 22+]
在使用 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. Python is 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---------------------------------------------------------------------------Test One: Required System Directories (Linux Only).If one of these system directories is missing, inxi cannot operate:/proc....................................................................... Present/sys........................................................................ PresentAll the directories are present.---------------------------------------------------------------------------Test Two: Required Core Applications.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.---------------------------------------------------------------------------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 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.---------------------------------------------------------------------------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/digdmidecode (info: -M if no 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,-Nx module 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.---------------------------------------------------------------------------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/wgetcurl (info: -i wan ip;-w/-W;-U/-! [11-15] (if supported))................... /usr/bin/curlAll 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)........................ PresentAll 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).................. PresentThe following files are missing from your system:File: /var/run/dmesg.boot---------------------------------------------------------------------------All tests completed.
Inxi 工具的基本用法
用下麵的基本用法獲取係統和硬件的詳細信息。
獲取 Linux 係統信息
Inix 不加任何選項就能輸出下麵的信息:CPU 、內核、開機時長、內存大小、硬盤大小、進程數、登錄終端以及 Inxi 版本。
$ inxiCPU~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 選項查看本機係統信息(主機名、內核信息、桌麵環境和發行版):
$ inxi -SSystem: Host: TecMint Kernel: 4.4.0-21-generic x86_64 (64 bit) Desktop: Cinnamon 3.0.7Distro: Linux Mint 18 Sarah
獲取電腦機型
使用 -M 選項查看機型(筆記本/台式機)、產品 ID 、機器版本、主板、製造商和 BIOS 等信息:
$ inxi -MMachine: System: LENOVO (portable) product: 20354 v: Lenovo Z50-70Mobo: LENOVO model: Lancer 5A5 v: 31900059WIN Bios: LENOVO v: 9BCN26WW date: 07/31/2014
獲取 CPU 及主頻信息
使用 -C 選項查看完整的 CPU 信息,包括每核 CPU 的頻率及可用的最大主頻。
$ inxi -CCPU: Dual core Intel Core i5-4210U (-HT-MCP-) cache: 3072 KBclock speeds: max: 2700 MHz 1: 1942 MHz 2: 1968 MHz 3: 1734 MHz 4: 1710 MHz
獲取顯卡信息
使用 -G 選項查看顯卡信息,包括顯卡類型、顯示服務器、係統分辨率、GLX 渲染器和 GLX 版本等等(LCTT 譯注: GLX 是一個 X 窗口係統的 OpenGL 擴展)。
$ inxi -GGraphics: Card-1: Intel Haswell-ULT Integrated Graphics ControllerCard-2: NVIDIA GM108M [GeForce 840M]Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.05hzGLX Renderer: Mesa DRI Intel Haswell Mobile GLX Version: 3.0 Mesa 11.2.0
獲取聲卡信息
使用 -A 選項查看聲卡信息:
$ inxi -AAudio: Card-1 Intel 8 Series HD Audio Controller driver: snd_hda_intel Sound: ALSA v: k4.4.0-21-genericCard-2 Intel Haswell-ULT HD Audio Controller driver: snd_hda_intel
獲取網卡信息
使用 -N 選項查看網卡信息:
$ inxi -NNetwork: Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller driver: r8169Card-2: Realtek RTL8723BE PCIe Wireless Network Adapter driver: rtl8723be
獲取硬盤信息
使用 -D 選項查看硬盤信息(大小、ID、型號):
$ inxi -DDrives: HDD Total Size: 1000.2GB (20.0% used) ID-1: /dev/sda model: ST1000LM024_HN size: 1000.2GB
獲取簡要的係統信息
使用 -b 選項顯示上述信息的簡要係統信息:
$ inxi -bSystem: Host: TecMint Kernel: 4.4.0-21-generic x86_64 (64 bit) Desktop: Cinnamon 3.0.7Distro: Linux Mint 18 SarahMachine: System: LENOVO (portable) product: 20354 v: Lenovo Z50-70Mobo: LENOVO model: Lancer 5A5 v: 31900059WIN Bios: LENOVO v: 9BCN26WW date: 07/31/2014CPU: Dual core Intel Core i5-4210U (-HT-MCP-) speed/max: 2018/2700 MHzGraphics: Card-1: Intel Haswell-ULT Integrated Graphics ControllerCard-2: NVIDIA GM108M [GeForce 840M]Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.05hzGLX Renderer: Mesa DRI Intel Haswell Mobile GLX Version: 3.0 Mesa 11.2.0Network: Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller driver: r8169Card-2: Realtek RTL8723BE PCIe Wireless Network Adapter driver: rtl8723beDrives: 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 選項輸出完整的硬盤分區信息,包括每個分區的分區大小、已用空間、可用空間、文件係統以及文件係統類型。
$ inxi -pPartition: ID-1: / size: 324G used: 183G (60%) fs: ext4 dev: /dev/sda10ID-2: swap-1 size: 4.00GB used: 0.00GB (0%) fs: swap dev: /dev/sda9
獲取完整的 Linux 係統信息
使用 -F 選項查看可以完整的 Inxi 輸出(安全起見比如網絡 IP 地址信息沒有顯示,下麵的示例隻顯示部分輸出信息):
$ inxi -FSystem: Host: TecMint Kernel: 4.4.0-21-generic x86_64 (64 bit) Desktop: Cinnamon 3.0.7Distro: Linux Mint 18 SarahMachine: System: LENOVO (portable) product: 20354 v: Lenovo Z50-70Mobo: LENOVO model: Lancer 5A5 v: 31900059WIN Bios: LENOVO v: 9BCN26WW date: 07/31/2014CPU: Dual core Intel Core i5-4210U (-HT-MCP-) cache: 3072 KBclock speeds: max: 2700 MHz 1: 1716 MHz 2: 1764 MHz 3: 1776 MHz 4: 1800 MHzGraphics: Card-1: Intel Haswell-ULT Integrated Graphics ControllerCard-2: NVIDIA GM108M [GeForce 840M]Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.05hzGLX Renderer: Mesa DRI Intel Haswell Mobile GLX Version: 3.0 Mesa 11.2.0Audio: Card-1 Intel 8 Series HD Audio Controller driver: snd_hda_intel Sound: ALSA v: k4.4.0-21-genericCard-2 Intel Haswell-ULT HD Audio Controller driver: snd_hda_intelNetwork: Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller driver: r8169IF: enp1s0 state: up speed: 100 Mbps duplex: full mac: 28:d2:44:eb:bd:98Card-2: Realtek RTL8723BE PCIe Wireless Network Adapter driver: rtl8723beIF: wlp2s0 state: down mac: 38:b1:db:7c:78:c7Drives: HDD Total Size: 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-1 size: 4.00GB used: 0.00GB (0%) fs: swap dev: /dev/sda9RAID: No RAID devices: /proc/mdstat, md_mod kernel module presentSensors: System Temperatures: cpu: 56.0C mobo: N/AFan Speeds (in rpm): cpu: N/AInfo: Processes: 234 Uptime: 3:26 Memory: 3188.9/7879.9MB Client: Shell (bash) inxi: 2.2.35
使用 Inxi 工具監控 Linux 係統
下麵是監控 Linux 係統進程、開機時間和內存的幾個選項的使用方法。
監控 Linux 進程的內存使用
使用下麵的命令查看進程數、開機時間和內存使用情況:
$ inxi -IInfo: Processes: 232 Uptime: 3:35 Memory: 3256.3/7879.9MB Client: 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 - top 5 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
----------------- Linux Memoery Usage -----------------$ inxi -t mProcesses: Memory: MB / % used - Used/Total: 3212.5/7879.9MB - top 5 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 and Memory Usage -----------------$ inxi -t cmProcesses: CPU: % used - top 5 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 - top 5 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 - top 10 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:最後更新:2017-05-22 14:32:43 上一篇:
從volatile解讀ConcurrentHashMap(jdk1.6.0)無鎖讀 下一篇:
Java IO: ByteArrayInputStream