现在开始玩Linux系统的新手越来越多了,但是Linux对于很多新手来说,还是有那么一点纸一样的难度的,在windows系统下,我们可以很方便的查看到机器的硬件的配置和信息,那么在Linux下面,如何查看硬件信息呢,OK,下面就带领LINUX菜鸟们如何查看机器的硬件配置和信息,首先是几个小点心,开开大家的胃口,告诉大家其实有很多命令可以单独实现你想要知道的硬件信息,如果等不及了,呵呵,可以直接看最后的主角命令,哈哈,这里暂时保密。
1. 显示主机的体系结构
[root@localhost ~]# arch ##这2个命令都是同样的功能
i686
[root@localhost ~]# uname -m
i686
2. 显示内存使用情况
[root@localhost ~]# cat /proc/meminfo
MemTotal: 515340 kB #物理内存大小
MemFree: 37884 kB
Buffers: 49864 kB
Cached: 334912 kB
SwapCached: 0 kB
Active: 176996 kB
Inactive: 258940 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 515340 kB
LowFree: 37884 kB
SwapTotal: 1048568 kB
SwapFree: 1048568 kB
Dirty: 40 kB
Writeback: 0 kB
AnonPages: 51160 kB
Mapped: 19008 kB
Slab: 33948 kB
PageTables: 2012 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 1306236 kB
Committed_AS: 310776 kB
VmallocTotal: 507896 kB
VmallocUsed: 3784 kB
VmallocChunk: 503984 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 4096 kB
[root@localhost ~]# free #查看物理内存大小 这2个命令同样功能
total used free shared buffers cached
Mem: 515340 477456 37884 0 49872 334904
-/+ buffers/cache: 92680 422660
Swap: 1048568 0 1048568
[root@localhost ~]#
3.查看CPU信息
[root@localhost ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 13
model name : Intel(R) Pentium(R) M processor 1.70GHz
stepping : 8
cpu MHz : 1695.000
cache size : 2048 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss nx constant_tsc up
bogomips : 3390.00
4. 查看显卡信息
[root@localhost ~]# lspci | grep -i VGA
00:0f.0 VGA compatible controller: VMware SVGA II Adapter #这是我的虚拟机
[root@localhost ~]# dmesg | grep -i VGA
Console: colour VGA+ 80x25
[root@localhost ~]#
5. 显示网卡信息
[root@localhost ~]# lspci | grep -i eth
02:00.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
6. 显示硬盘信息
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6983168 1639980 4982740 25% /
/dev/sda1 101086 12054 83813 13% /boot
tmpfs 257668 0 257668 0% /dev/shm
[root@localhost ~]# fdisk -l #新手使用这个命令一定不能漏了-l这个参数,否则后果自负。
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1044 8281507+ 8e Linux LVM
[root@localhost ~]#
哎,好累啊,其实还有许多硬件的信息呢,下面隆重推出本文的主角:一个超级无敌的命令,你可以看到几乎是一切你想知道的各种硬件配置和详细的参数,:当当当“,下面这个超级无敌的命令就是-------dmidecode,据说这个命令的内容读取子BIOS,那是相当的牛X和准确啊,哈哈,前提是你的BIOS没有被JS动过手脚啊,哈哈。
[root@localhost ~]# dmidecode > hardware.txt #由于这个命令的输出超级多,把他写入到这个hardware.txt 文件里,你可以在里面找到你想要的一切。。。
[root@localhost ~]# vi hardware.txt
# dmidecode 2.9
SMBIOS 2.31 present.
45 structures occupying 1654 bytes.
Table at 0x000E0010.
Handle 0x0000, DMI type 0, 20 bytes
BIOS Information
Vendor: Phoenix Technologies LTD ##BIOS版本的信息
Version: 6.00
Release Date: 12/06/2006
Address: 0xE78A0
Runtime Size: 100192 bytes
ROM Size: 64 kB
Characteristics:
ISA is supported
PCI is supported
PC Card (PCMCIA) is supported
PNP is supported
APM is supported
BIOS is upgradeable
BIOS shadowing is allowed
ESCD support is available
USB legacy is supported
....................
Handle 0x001A, DMI type 10, 8 bytes
On Board Device 1 Information ###显卡的信息
Type: Video
Status: Disabled
Description: VMware SVGA II
On Board Device 2 Information
Type: Sound ####声卡的信息
Status: Disabled
Description: ES1371
------------------------
Handle 0x0002, DMI type 2, 8 bytes
Base Board Information
Manufacturer: Intel Corporation ###主板的信息
Product Name: 440BX Desktop Reference Platform
Version: None
Serial Number: None
Handle 0x001B, DMI type 11, 5 bytes
"hardware.txt" 573L, 13913C
哈哈,就举例到这里吧,最后以这个命令结尾,几乎可以不看前面的内容了,就这个dmidecode 几乎可以通吃所有硬件信息了,最后我给本文改名叫做”Linux下一个命令通吃硬件信息“哈哈,如果你还不是很熟悉,还不试验下,当然读者有更好的方法,记得给我留言,万分感谢。