当前位置: 首页>>技术教程>>正文


使用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/article/9095.html,未经允许,请勿转载。