在Linux下查看硬件信息的最基本方法就是利用/proc文件系统,这个动态文件系统里提供了很多相关的信息,比如:
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
[root@localhost ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Genuine Intel(R) CPU T1400 @ 1.73GHz
stepping : 13
cpu MHz : 1729.001
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
...
[root@localhost ~]# cat /proc/ioports
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-0060 : keyboard
0064-0064 : keyboard
0070-0071 : rtc0
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : 0000:00:07.1
0170-0177 : ata_piix
01f0-01f7 : 0000:00:07.1
01f0-01f7 : ata_piix
02f8-02ff : serial
0376-0376 : 0000:00:07.1
...
[root@localhost ~]# cat /proc/meminfo
MemTotal: 1031320 kB
MemFree: 54164 kB
Buffers: 83676 kB
Cached: 659676 kB
SwapCached: 8 kB
Active: 396052 kB
Inactive: 463516 kB
Active(anon): 10644 kB
Inactive(anon): 110216 kB
Active(file): 385408 kB
Inactive(file): 353300 kB
Unevictable: 0 kB
Mlocked: 0 kB
HighTotal: 141256 kB
HighFree: 6132 kB
LowTotal: 890064 kB
LowFree: 48032 kB
SwapTotal: 2064376 kB
SwapFree: 2064368 kB
Dirty: 0 kB
Writeback: 0 kB
...
[root@localhost ~]# cat /proc/bus/usb/devices
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0001 Rev= 2.06
S: Manufacturer=Linux 2.6.32-71.el6.i686 uhci_hcd
S: Product=UHCI Host Controller
S: SerialNumber=0000:02:00.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms
...
[root@localhost ~]# cat /proc/bus/pci/devices
0000 80867190 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 agpgart-intel
0008 80867191 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0038 80867110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0039 80867111 0 1f0 3f6 170 376 10c1 0 0 8 0 8 0 10 0 0 ata_piix
003b 80867113 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0
003f 15ad0740 9 1081 0 0 0 0 0 0 40 0 0 0 0 0...
[root@localhost ~]# cat /proc/bus/input/devices
I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name=
"Power Button"
P: Phys=LNXPWRBN/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
U: Uniq=
H: Handlers=kbd event0
B: EV=3
B: KEY=100000 0 0 0
...
|
/proc文件系统提供了很多用户接口,但是可读性不太好,所以也就有了一些更好的工具,比如:lscpu、dmidecode、lspci、smartctl、lsusb,这些命令工具的简单使用看man手册即可。当然,也还有很多其它很不错的工具,但这几个命令基本也就足够了,用得最多的也就是这几个,比如遇到电脑网卡不正常工作就先用lspci看看网卡硬件是否已经找到了等等。示例用法如下:
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
[root@localhost ~]# lscpu
Architecture: i686
CPU(s): 1
Thread(s) per core: 1
Core(s) per socket: 1
CPU socket(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 15
Stepping: 13
CPU MHz: 1729.001
L1d cache: 32K
L1i cache: 32K
L2 cache: 512K
[root@localhost ~]# dmidecode -t cache
# dmidecode 2.10
SMBIOS 2.4 present.
Handle 0x001C, DMI type 7, 19 bytes
Cache Information
Socket Designation: L1 Cache
Configuration: Enabled, Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 16 kB
Maximum Size: 16 kB
Supported SRAM Types:
Burst
Pipeline Burst
Asynchronous
Installed SRAM Type: Asynchronous
Speed: Unknown
Error Correction Type: Unknown
System Type: Unknown
Associativity: Unknown
...
[root@localhost ~]# dmidecode -t memory
# dmidecode 2.10
SMBIOS 2.4 present.
Handle 0x000C, DMI type 5, 46 bytes
Memory Controller Information
Error Detecting Method: None
Error Correcting Capabilities:
None
Supported Interleave: One-way Interleave
Current Interleave: One-way Interleave
Maximum Memory Module Size: 32768 MB
Maximum Total Memory Size: 491520 MB
Supported Speeds:
70 ns
60 ns
Supported Memory Types:
FPM
EDO
DIMM
SDRAM
Memory Module Voltage: 3.3 V
...
[root@localhost ~]# dmidecode -t bios
# dmidecode 2.10
SMBIOS 2.4 present.
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: Phoenix Technologies LTD
Version: 6.00
Release Date: 09/18/2009
Address: 0xEA2E0
Runtime Size: 89376 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
Smart battery is supported
BIOS boot specification is supported
Targeted content distribution is supported
BIOS Revision: 4.6
Firmware Revision: 0.0
[root@localhost ~]# lspci -t -vv
-[0000:00]-+-00.0 Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge
+-01.0-[01]--
+-07.0 Intel Corporation 82371AB/EB/MB PIIX4 ISA
+-07.1 Intel Corporation 82371AB/EB/MB PIIX4 IDE
+-07.3 Intel Corporation 82371AB/EB/MB PIIX4 ACPI
+-07.7 VMware Virtual Machine Communication Interface
+-0f.0 VMware SVGA II Adapter
+-10.0 LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI
+-11.0-[02]--+-00.0 Intel Corporation 82371AB/EB/MB PIIX4 USB
| +-01.0 Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
| +-02.0 Ensoniq ES1371 [AudioPCI-97]
| \-03.0 VMware USB2 EHCI Controller
...
[root@localhost ~]# smartctl -i /dev/sda1
smartctl 5.39.1 2010-01-28 r3054 [i686-pc-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http:
Device: VMware, VMware Virtual S Version: 1.0
Device type: disk
Local Time is: Tue Nov 29 23:36:19 2011 EST
Device does not support SMART
[root@localhost ~]# lsusb
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
|