Answers:
显示内核版本和系统架构
uname -a
显示发行名称和版本
head -n1 /etc/issue
显示系统上注册的所有分区
cat /proc/partitions
显示系统看到的RAM总数
grep MemTotal /proc/meminfo
显示CPU信息
grep "model name" /proc/cpuinfo
显示有关磁盘sda的信息
hdparm -i /dev/sda
尝试 lshw
它将建议您将其运行为root
,因此请尝试
sudo lshw
以下是在Linux上检查硬件的命令列表。请注意,并非所有命令在所有发行版上都可用。最好先以root身份启动(或通过sudo)以获取所有信息。
命令:lscpu
命令:lshal
命令:lshw
命令:lspci
命令:lsusb
命令:dmidecode
这是您想要的各种Linux命令的链接:
http://www.cyberciti.biz/tips/linux-command-to-gathers-up-information-about-a-linux-system.html
具体来说,您正在寻找类似以下的命令:
cat /proc/cpuinfo
free -m
cat /proc/version
而且,只要加上我的两分钱,我也会尝试
hwinfo
在使用完整命令之前,您可以尝试使用简短版本,
hwinfo --short
可能已经提供了您要搜索的信息。fll版本的细节非常丰富,因此最好用
hwinfo | more
并且,顺便说一句,可以通过以下方式获得lshw提供的信息的便捷压缩形式:
sudo lshw -businfo
具有易于阅读的输出:
Bus info Device Class Description
========================================================
system PORTEGE R930 (PT331E)
bus PORTEGE R930
memory 128KiB BIOS
memory 6GiB System Memory
memory 4GiB SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
memory 2GiB SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
cpu@0 processor Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
memory 32KiB L1 cache
memory 256KiB L2 cache
memory 4MiB L3 cache
memory 32KiB L1 cache
pci@0000:00:00.0 bridge 3rd Gen Core processor DRAM Controller
pci@0000:00:02.0 display 3rd Gen Core processor Graphics Controller
pci@0000:00:14.0 bus 7 Series/C210 Series Chipset Family USB xHCI Host Controller
pci@0000:00:16.0 communication 7 Series/C210 Series Chipset Family
MEI Controller #1
pci@0000:00:16.3 communication 7 Series/C210 Series Chipset Family KT Controller
pci@0000:00:19.0 eth0 network 82579LM Gigabit Network Connection
pci@0000:00:1a.0 bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
pci@0000:00:1b.0 multimedia 7 Series/C210 Series Chipset Family High Definition Audio Controller
pci@0000:00:1c.0 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 1
pci@0000:01:00.0 generic MMC/SD Host Controller
pci@0000:00:1c.1 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 2
pci@0000:00:1c.2 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 3
pci@0000:04:00.0 wlan0 network Centrino Advanced-N 6235
pci@0000:00:1c.5 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 6
pci@0000:00:1d.0 bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
pci@0000:00:1f.0 bridge QM77 Express Chipset LPC Controller
pci@0000:00:1f.2 storage 7 Series Chipset Family 6-port SATA Controller [AHCI mode]
scsi0 storage
scsi@0:0.0.0 /dev/sda disk 256GB TOSHIBA THNSNF25
scsi@0:0.0.0,1 /dev/sda1 volume 27GiB EXT4 volume
scsi@0:0.0.0,2 /dev/sda2 volume 210GiB Extended partition
/dev/sda5 volume 5722MiB Linux swap / Solaris partition
/dev/sda6 volume 204GiB Linux filesystem partition
scsi2 storage
scsi@2:0.0.0 /dev/cdrom disk DVD-RAM UJ8C2
power Lithium Ion Battery
power
wwan0 network Ethernet interface
还有一个lshw的图形版本,称为lshw-gtk:
sudo lshw-gtk &
根据您所使用的特定发行版,可能需要安装其中大多数命令(apt-get install,yum,pacman等)。
还有一个流行的非标准脚本(需要安装),称为screenFetch:
screenFetch是“ Bash屏幕截图信息工具”。这个方便的Bash脚本可用于生成您现在在每个人的屏幕快照中看到的那些漂亮的终端主题信息+ ASCII分发徽标之一。它将自动检测您的发行版,并在右侧显示该发行版徽标的ASCII版本和一些有价值的信息。有一些选项可以指定不使用ASCII文字,颜色,在显示信息时进行屏幕截图,甚至自定义屏幕截图命令!该脚本非常容易添加,并且可以轻松扩展。
如果您使用p来管理基础结构,请使用事实
facter processorcount sp_number_processors sp_current_processor_speed memorytotal operatingsystem osfamily operatingsystemrelease
processorcount => 4
sp_current_processor_speed => 2.5 GHz
sp_number_processors => 2
memorytotal => 8.00 GB
osfamily => RedHat
operatingsystem => CentOS
operatingsystemrelease => 6.5
您甚至可以输出为yaml或json
facter osfamily operatingsystem --json
{"osfamily":"Darwin","operatingsystem":"Darwin"}
facter osfamily operatingsystem --yaml
osfamily: Darwin
operatingsystem: Darwin
厨师有一个类似的工具叫做ohai
的HW-探针工具一次收集所有的硬件相关的制表的输出(HWINFO,lspci的,lscpu,hdparm的,smartctl读取,的dmidecode等)。