當前位置: 首頁>>技術教程>>正文


使用Linux和inxi檢索係統和硬件信息

, ,
檢索係統和硬件信息從未如此簡單。現在,通過命令行係統信息腳本可以立即獲取諸如當前內核,VGA模型和驅動程序乃至正在使用的軟件存儲庫之類的信息。 inxi不僅可以輕鬆檢索hard-drive的硬件信息,而且還包含其他係統信息,例如使用的磁盤空間和塊設備文件名。最令人驚訝和出乎意料的功能是檢索當前的本地天氣信息,我不確定此功能的可用性,但也許如果您擔心由於外界溫度造成的服務器過熱,inxi是您避免災難的工具。

inxi是非常易於使用的工具,不需要太多用法說明。在本文中,我們僅回顧了inxi提供的某些功能,隻是為了簡單說明此工具的功能。有關inxi的完整指南,請參見--help選項。

inxi安裝

inxi是標準Ubuntu和Fedora存儲庫中可用的貨幣。在編寫本文時,inbian在Debian linux中不可用。對於Debian安裝,請參見:在Debian Wheezy上安裝inxi係統信息腳本
以下是ubuntu和fedora linux的安裝說明:


UBUNTU:
$ sudo apt-get install inxi
FEDORA:
$ sudo yum install inxi

快速的係統和硬件概述

沒有任何選項的inxi可以快速打印係統概述。


$ inxi 
CPU~Dual core Intel Core i7-2640M (-HT-MCP-) clocked at 815 Mhz Kernel~3.14.6-200.fc20.x86_64 x86_64 Up~2:31 Mem~2558.2/7868.2MB HDD~160.0GB(63.9% used) Procs~198 Client~Shell inxi~2.1.28

完整的係統和硬件概述

選項-F提供有關整個係統的完整信息:


$ inxi -F
System:    Host: localhost.localdomain Kernel: 3.14.6-200.fc20.x86_64 x86_64 (64 bit) Desktop: Gnome 3.10.4 
           Distro: Fedora release 20 (Heisenbug) 
Machine:   System: LENOVO product: 4286CTO v: ThinkPad X220
           Mobo: LENOVO model: 4286CTO Bios: LENOVO v: 8DET61WW (1.31 ) date: 04/25/2012
CPU:       Dual core Intel Core i7-2640M (-HT-MCP-) cache: 4096 KB 
           Clock Speeds: 1: 3309 MHz 2: 3353 MHz 3: 3309 MHz 4: 3309 MHz
Graphics:  Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller
           Display Server: Fedora X.org 1.14.4 drivers: intel (unloaded: fbdev,vesa) Resolution: This email address is being protected from spambots. You need JavaScript enabled to view it.
	document.getElementById('cloakcc791a3fd0261d67aacc65eb3767e933').innerHTML='';var prefix='ma'+'il'+'to';var path='hr'+'ef'+'=';var addycc791a3fd0261d67aacc65eb3767e933='1366x768'+'@';addycc791a3fd0261d67aacc65eb3767e933=addycc791a3fd0261d67aacc65eb3767e933+'60'+'.'+'0hz';var addy_textcc791a3fd0261d67aacc65eb3767e933='1366x768'+'@'+'60'+'.'+'0hz';document.getElementById('cloakcc791a3fd0261d67aacc65eb3767e933').innerHTML+=''+addy_textcc791a3fd0261d67aacc65eb3767e933+'';
           GLX Renderer: Mesa DRI Intel Sandybridge Mobile GLX Version: 3.0 Mesa 10.1.5
Audio:     Card-1 Intel 6 Series/C200 Series Family High Definition Audio Controller driver: snd_hda_intel 
           Card-2 Licensed by Sony Entertainment America driver: USB Audio 
           Sound: Advanced Linux Sound Architecture v: k3.14.6-200.fc20.x86_64
Network:   Card-1: Intel 82579LM Gigabit Network Connection driver: e1000e
           IF: em1 state: down mac: 3c:97:0e:02:98:c8
           Card-2: Intel Centrino Advanced-N 6205 [Taylor Peak] driver: iwlwifi
           IF: wlp3s0 state: up mac: 8c:70:5a:92:f6:e0
Drives:    HDD Total Size: 160.0GB (63.9% used) ID-1: /dev/sda model: INTEL_SSDSA2BW16 size: 160.0GB
Partition: ID-1: / size: 50G used: 14G (31%) fs: ext4 dev: /dev/dm-2 
           ID-2: /boot size: 477M used: 141M (32%) fs: ext4 dev: /dev/sda1 
           ID-3: /home size: 90G used: 74G (88%) fs: ext4 dev: /dev/dm-3 
           ID-4: swap-1 size: 8.34GB used: 0.00GB (0%) fs: swap dev: /dev/dm-1 
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 71.0C mobo: N/A 
           Fan Speeds (in rpm): cpu: 3893 
Info:      Processes: 200 Uptime: 2:33 Memory: 2672.2/7868.2MB Client: Shell (bash) inxi: 2.1.28 

檢索額外信息

如果其他數據可用於任何係統或硬件組件-xxx選項將指示inxi顯示最大可能的信息。例如,以下是有關網卡的標準信息:


$ inxi -N
Network:   Card-1: Intel 82579LM Gigabit Network Connection driver: e1000e
           Card-2: Intel Centrino Advanced-N 6205 [Taylor Peak] driver: iwlwifi

-xxx選項,我們可以看到上述輸出的其他信息:


$ inxi -Nxxx
Network:   Card-1: Intel 82579LM Gigabit Network Connection
           driver: e1000e v: 2.3.2-k port: 4080 bus-ID: 00:19.0 chip-ID: 8086:1502
           Card-2: Intel Centrino Advanced-N 6205 [Taylor Peak]
           driver: iwlwifi v: in-tree:d bus-ID: 03:00.0 chip-ID: 8086:0085

機器數據,主板和BIOS信息


$ inxi -M
Machine:   System: LENOVO product: 4286CTO v: ThinkPad X220
           Mobo: LENOVO model: 4286CTO Bios: LENOVO v: 8DET61WW (1.31 ) date: 04/25/2012

檢索存儲庫信息


$ inxi -r
Repos:     Active yum sources in file: /etc/yum.repos.d/google-chrome.repo
           google-chrome ~ http://dl.google.com/linux/chrome/rpm/stable/x86_64
           Active yum sources in file: /etc/yum.repos.d/rpmfusion-free-updates.repo
           rpmfusion-free-updates ~ http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-updates-released-$releasever&arch=$basearch
           Active yum sources in file: /etc/yum.repos.d/rpmfusion-free.repo
           rpmfusion-free ~ http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-$releasever&arch=$basearch
           Active yum sources in file: /etc/yum.repos.d/rpmfusion-nonfree-updates.repo
           rpmfusion-nonfree-updates ~ http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-fedora-updates-released-$releasever&arch=$basearch
           Active yum sources in file: /etc/yum.repos.d/rpmfusion-nonfree.repo
           rpmfusion-nonfree ~ http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-fedora-$releasever&arch=$basearch
           Active yum sources in file: /etc/yum.repos.d/virtualbox.repo
           virtualbox ~ http://download.virtualbox.org/virtualbox/rpm/fedora/$releasever/$basearch

檢索天氣信息

如前所述,inxi還可以提供當前的本地天氣信息:


$ inxi -w
Weather:   Conditions: 53 F (12 C) - Clear Time: June 25, 11:05 AM CST

對於其他位置使用-W選項,後跟tzname位置。例如:


$ inxi -W Bratislava,Slovakia
Weather:   Conditions: 54 F (12 C) - Clear Time: June 25, 4:11 AM CEST

結論

以上隻是inxi用法的幾個示例,該列表很容易擴展以填滿整本書。 inxi是一個功能強大的工具,不容忽視。借助inxi無休止的係統和硬件信息輸出,可以顯著改善Linux係統管理自動化。

參考資料

本文由Ubuntu問答整理, 博文地址: https://ubuntuqa.com/zh-tw/article/9095.html,未經允許,請勿轉載。