Inxi:Linux上查看硬件信息的一款神器
譯文【2014年1月13日 51CTO外電頭條】Linux用戶們平時糾結的一件很常見的事情就是,查看操作系統檢測到了什么硬件,這些硬件運行狀況又如何。由于除非操作系統可識別某硬件,否則它根本不會使用該硬件。不過外頭有一大批命令可以查看硬件信息。
桌面端有為數不少的圖形用戶界面(GUI)工具,比如hardinfo和sysinfo等等,但是有一款普通的命令行工具卻實用得多,而這方面正是Inxi所擅長的。Inxi是一組腳本,可以檢測關于硬件的一大堆信息,包括廠商詳細信息和設備驅動程序配置等。而最重要的是,它能夠以一種易于閱讀的格式,打印輸出各種信息。
安裝inxi
Inxi就在大多數發行版的默認軟件庫里面,所以可以迅速獲得。
- # Ubuntu/Debian用戶
- $ sudo apt-get install inxi
- # CentOS/Fedora用戶
- $ sudo yum install inxi
如果inxi沒在你所用的發行版上,那么可以通過按照這里給出的指示,安裝它。
使用inxi
Inxi隨帶數量眾多的選項,可以盡量詳細地顯示關于不同硬件部件的更多信息。所以在本文中我們將僅僅探討一些基本方面來開始入手;有興趣的話,你可以探究其余方面。
1. 運行Inxi
為了獲得你硬件的簡要信息,只要按下面這樣運行inxi。
- $ inxi -c 5
- CPU~Quad core Intel Core2 Quad CPU Q8400 (-MCP-) clocked at 1998.000 Mhz Kernel~3.11.0
- -12-generic x86_64 Up~1:43 Mem~4774.1/7975.7MB HDD~500.1GB(38.8% used) Procs~301 Client
- ~Shell inxi~1.9.12
顏色方案:Inxi的輸出結果標以顏色;如果你需要改變顏色,以便更一目了然,只要使用c選項,后面再跟上一個0到32之間的隨機數。
2. 獲得基本信息
b標記會顯示關于系統的數量眾多的基本信息。
- $ inxi -c 5 -b
- System: Host: enlightened Kernel: 3.11.0-12-generic x86_64 (64 bit) Desktop: KDE 4.11.2 Distro: Ubuntu 13.10
- Machine: Mobo: Intel model: DG35EC version: AAE29266-210
- Bios: Intel version: ECG3510M.86A.0112.2009.0203.1136 date: 02/03/2009
- CPU: Quad core Intel Core2 Quad CPU Q8400 (-MCP-) clocked at 1998.00 MHz
- Graphics: Card: Intel 82G35 Express Integrated Graphics Controller
- X.Org: 1.14.3 drivers: intel (unloaded: fbdev,vesa) Resolution: 1360x768@60.0hz
- GLX Renderer: Mesa DRI Intel 965G GLX Version: 2.1 Mesa 9.2.1
- Network: Card: Intel 82566DC Gigabit Network Connection driver: e1000e
- Drives: HDD Total Size: 500.1GB (38.8% used)
- Info: Processes: 304 Uptime: 1:50 Memory: 4983.3/7975.7MB Client: Shell (bash) inxi: 1.9.12
關于系統的輸出信息含有大量信息,涉及處理器、圖形卡、驅動器和安裝的操作系統。你在安裝驅動程序或診斷問題時,這些信息非常有用。
3. 打印輸出硬驅分區信息
現在不妨打印輸出關于硬驅分區的信息。它會打印輸出所有已掛載的分區以及掛載點及磁盤使用信息。
- $ inxi -p
- Partition: ID: / size: 97G used: 22G (24%) fs: ext4 ID: /media/13f35f59-f023-4d98-b06f-9dfaebefd6c1 size: 196G used: 132G (71%) fs: ext4
- ID: /media/4668484A68483B47 size: 98G used: 28G (29%) fs: fuseblk ID: swap-1 size: 2.05GB used: 0.00GB (0%) fs: swap
想打印輸出未掛載分區以及已掛載分區的信息,只要使用帶p的o選項。
- $ inxi -p
- Partition: ID: / size: 97G used: 22G (24%) fs: ext4 ID: /media/13f35f59-f023-4d98-b06f
- -9dfaebefd6c1 size: 196G used: 132G (71%) fs: ext4
- ID: /media/4668484A68483B47 size: 98G used: 28G (29%) fs: fuseblk ID: swap-
- 1 size: 2.05GB used: 0.00GB (0%) fs: swap
- enlightened@enlightened:~$ inxi -po
- Partition: ID: / size: 97G used: 22G (24%) fs: ext4 ID: /media/13f35f59-f023-4d98-b06f
- -9dfaebefd6c1 size: 196G used: 132G (71%) fs: ext4
- ID: /media/4668484A68483B47 size: 98G used: 28G (29%) fs: fuseblk ID: swap-
- 1 size: 2.05GB used: 0.00GB (0%) fs: swap
- Unmounted: ID: /dev/sda1 size: 75.16G label: N/A uuid: 5E38BE8B38BE6227
使用D選項,打印輸出硬驅的詳細信息,比如品牌、型號和尺寸。
- $ inxi -D
- Drives: HDD Total Size: 500.1GB (38.8% used) 1: id: /dev/sda model: ST3500418AS size: 500.1GB
4. 光驅的詳細信息
打印輸出所有驅動器的完整信息,包括所有硬驅和光驅及其具體規格。
- $ inxi -d
- Drives: HDD Total Size: 500.1GB (38.8% used) 1: id: /dev/sda model: ST3500418AS size: 500.1GB
- Optical: /dev/sr0 model: N/A dev-links: cdrom
- Features: speed: 12x multisession: yes audio: yes dvd: yes rw: cd-r,cd-rw,dvd-r,dvd-ram
信息的獲取就是這么快捷。
5. 網絡接口和配置
n選項完全打印輸出了關于網絡接口以及配置詳細情況的詳細信息。
- $ inxi -n
- Network: Card: Intel 82566DC Gigabit Network Connection driver: e1000e
- IF: eth0 state: up speed: 100 Mbps duplex: full mac: 00:1c:c0:f8:79:ee
使用帶n的i選項,即可獲得IP地址的詳細信息(包括廣域網和局域網)。
- $ inxi -ni
- Network: Card: Intel 82566DC Gigabit Network Connection driver: e1000e
- IF: eth0 state: up speed: 100 Mbps duplex: full mac: 00:1c:c0:f8:79:ee
- WAN IP: 122.163.33.2 IF: eth0 ip: 192.168.1.2
6. 顯示音頻/聲頻卡及圖形卡的信息
A選項可顯示音頻卡信息,而G選項可顯示圖形卡信息。
- $ inxi -AG
- Graphics: Card: Intel 82G35 Express Integrated Graphics Controller
- X.Org: 1.14.3 drivers: intel (unloaded: fbdev,vesa) Resolution: 1360x768@60.0hz
- GLX Renderer: Mesa DRI Intel 965G GLX Version: 2.1 Mesa 9.2.1
- Audio: Card: Intel 82801H (ICH8 Family) HD Audio Controller driver: snd_hda_intel Sound: ALSA ver: k3.11.0-12-generic
使用b選項后,圖形卡的詳細信息已經包含在內。
7. 顯示針對特定發行版的軟件庫數據:
- $ inxi -r
- Repos: Active apt sources in file: /etc/apt/sources.list
- deb http://in.archive.ubuntu.com/ubuntu/ saucy main restricted
- deb-src http://in.archive.ubuntu.com/ubuntu/ saucy main restricted
- deb http://in.archive.ubuntu.com/ubuntu/ saucy-updates main restricted
- deb-src http://in.archive.ubuntu.com/ubuntu/ saucy-updates main restricted
- deb http://in.archive.ubuntu.com/ubuntu/ saucy universe
- deb-src http://in.archive.ubuntu.com/ubuntu/ saucy universe
- deb http://in.archive.ubuntu.com/ubuntu/ saucy-updates universe
- deb-src http://in.archive.ubuntu.com/ubuntu/ saucy-updates universe
- deb http://in.archive.ubuntu.com/ubuntu/ saucy multiverse
- deb-src http://in.archive.ubuntu.com/ubuntu/ saucy multiverse
- deb http://in.archive.ubuntu.com/ubuntu/ saucy-updates multiverse
- deb-src http://in.archive.ubuntu.com/ubuntu/ saucy-updates multiverse
- deb http://in.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe multiverse
- deb-src http://in.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe multiverse
- deb http://security.ubuntu.com/ubuntu saucy-security main restricted
- deb-src http://security.ubuntu.com/ubuntu saucy-security main restricted
- deb http://security.ubuntu.com/ubuntu saucy-security universe
- deb-src http://security.ubuntu.com/ubuntu saucy-security universe
- deb http://security.ubuntu.com/ubuntu saucy-security multiverse
- deb-src http://security.ubuntu.com/ubuntu saucy-security multiverse
- deb http://extras.ubuntu.com/ubuntu saucy main
- deb-src http://extras.ubuntu.com/ubuntu saucy main
- deb http://archive.canonical.com/ saucy partner
- deb http://download.virtualbox.org/virtualbox/debian saucy contrib
- Active apt sources in file: /etc/apt/sources.list.d/google-chrome.list
- deb http://dl.google.com/linux/chrome/deb/ stable main
在CentOS上,你會獲得像這樣的界面:
- # inxi -r
- Repos: Active yum sources in file: /etc/yum.repos.d/CentOS-Base.repo
- base ~ http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
- updates ~ http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
- extras ~ http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
- Active yum sources in file: /etc/yum.repos.d/epel.repo
- epel ~ https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
- Active yum sources in file: /etc/yum.repos.d/nginx.repo
- nginx ~ http://nginx.org/packages/centos/$releasever/$basearch/
8. 打印輸出全部信息
與b(基本)選項相比,F選項更加詳細地顯示了系統信息。但它并不包含inxi所能報告的所有信息。
- # inxi -F
- System: Host: dhcppc3 Kernel: 2.6.32-358.11.1.el6.x86_64 x86_64 (64 bit)
- Console: tty 0 Distro: CentOS release 6.4 (Final)
- Machine: System: innotek product: VirtualBox version: 1.2 serial: 0
- Mobo: Oracle model: VirtualBox version: 1.2 serial: 0 Bios: innotek version: VirtualBox date: 12/01/2006
- CPU: Single core Intel Core2 Quad CPU Q8400 (-UP-) cache: 6144 KB flags: (lm nx sse sse2 sse3 ssse3) clocked at 2653.954 MHz
- Graphics: Card: InnoTek Systemberatung VirtualBox Graphics Adapter
- X-Vendor: N/A driver: N/A tty size: 76x26 Advanced Data: N/A for root out of X
- Audio: Card: Intel 82801AA AC'97 Audio Controller driver: Intel ICH Sound: ALSA ver: 1.0.21
- Network: Card: Intel 82540EM Gigabit Ethernet Controller driver: e1000
- IF: eth0 state: up speed: 1000 Mbps duplex: full mac: 08:00:27:54:e4:c6
- Drives: HDD Total Size: 4.3GB (32.6% used) 1: id: /dev/sda model: VBOX_HARDDISK size: 4.3GB
- Partition: ID: / size: 2.5G used: 1.3G (53%) fs: ext4 ID: /boot size: 485M used: 52M (12%) fs: ext4
- ID: swap-1 size: 1.04GB used: 0.00GB (0%) fs: swap
- RAID: No RAID devices detected - /proc/mdstat and md_mod kernel raid module present
- Sensors: None detected - is lm-sensors installed and configured?
- Info: Processes: 76 Uptime: 34 min Memory: 92.1/490.6MB Runlevel: 3 Client: Shell (bash) inxi: 1.9.14
使用i選項,即可打印輸出IP地址的信息。
- $ inxi -Fi
9. 打印輸出額外信息
x選項可以結合單個選項使用,打印輸出關于某個特定硬件或配置文件的補充或額外信息。
想打印輸出關于音頻系統的額外信息:
- $ inxi -A -x
- Audio: Card: Intel 82801H (ICH8 Family) HD Audio Controller driver: snd_hda_intel bus-ID: 00:1b.0
- Sound: Advanced Linux Sound Architecture ver: k3.11.0-12-generic
想獲得關于任何硬件配置文件子集的額外信息,只要使用x選項,如上所示。
想獲得更多的額外信息,可使用-xx選項。想獲得還要多的額外信息,可使用-xxx選項。之后,Inxi無法為你顯示更多的信息了。
小結
每個選項可以打印輸出關于某個特定硬件部件的信息。選擇需要查看的硬件部件,也可以打印輸出所有部件的信息;不管怎樣,都非常簡單、快捷。
相關資源:https://code.google.com/p/inxi/
原文鏈接:http://www.binarytides.com/inxi-system-information-linux/