【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
- 1.
- 2.
- 3.
- 4.
如果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
- 1.
- 2.
- 3.
- 4.
颜色方案: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
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
关于系统的输出信息含有大量信息,涉及处理器、图形卡、驱动器和安装的操作系统。你在安装驱动程序或诊断问题时,这些信息非常有用。
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
- 1.
- 2.
- 3.
想打印输出未挂载分区以及已挂载分区的信息,只要使用带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
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
使用D选项,打印输出硬驱的详细信息,比如品牌、型号和尺寸。
$ inxi -D
Drives: HDD Total Size: 500.1GB (38.8% used) 1: id: /dev/sda model: ST3500418AS size: 500.1GB
- 1.
- 2.
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
- 1.
- 2.
- 3.
- 4.
信息的获取就是这么快捷。
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
- 1.
- 2.
- 3.
使用带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
- 1.
- 2.
- 3.
- 4.
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
- 1.
- 2.
- 3.
- 4.
- 5.
使用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
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
在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/
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
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
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
使用i选项,即可打印输出IP地址的信息。
$ inxi -Fi
- 1.
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
- 1.
- 2.
- 3.
想获得关于任何硬件配置文件子集的额外信息,只要使用x选项,如上所示。
想获得更多的额外信息,可使用-xx选项。想获得还要多的额外信息,可使用-xxx选项。之后,Inxi无法为你显示更多的信息了。
小结
每个选项可以打印输出关于某个特定硬件部件的信息。选择需要查看的硬件部件,也可以打印输出所有部件的信息;不管怎样,都非常简单、快捷。
相关资源:https://code.google.com/p/inxi/
原文链接:http://www.binarytides.com/inxi-system-information-linux/