linux查看硬件相关信息

一、 CPU相关
1. CPU的硬件信息
[@125 opt]# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 45
model name      :        Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
stepping        : 7
cpu MHz         : 2000.062
cache size      : 20480 KB
physical id     : 0
siblings        : 16
core id         : 0
cpu cores       : 8
apicid          : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx pdpe1gb rdtscp lm constant_tsc
 ida nonstop_tsc arat pni monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
bogomips        : 4000.12
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management: [8]


二、 内存相关
1. 内存硬件信息
[@125 opt]# cat /proc/meminfo
MemTotal:     32915200 kB
MemFree:      10768212 kB
Buffers:        318444 kB
Cached:       19147620 kB
SwapCached:        368 kB
Active:        2555992 kB
Inactive:     18833328 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:     32915200 kB
LowFree:      10768212 kB
SwapTotal:     8385920 kB
SwapFree:      8385552 kB
Dirty:            7860 kB
Writeback:           0 kB
AnonPages:     1923272 kB
Mapped:          23200 kB
Slab:           703024 kB
PageTables:       8896 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:  24843520 kB
Committed_AS:  2439540 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    271820 kB
VmallocChunk: 34359464951 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

2. 内存使用情况 free
[@125 opt]# free
             total       used       free     shared    buffers     cached
Mem:      32915200    3673460   29241740          0     256348     888828
-/+ buffers/cache:    2528284   30386916
Swap:      8385920          0    8385920

三、 硬盘相关
[@ltv_125 opt]# df -h -T
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3    3.9G  542M  3.2G  15% /
/dev/sda6     ext3    791G   20G  730G   3% /opt
/dev/sda3     ext3    3.9G  651M  3.1G  18% /var
/dev/sda5     ext3    4.9G  2.2G  2.5G  47% /usr
tmpfs        tmpfs     16G   40K   16G   1% /dev/shm


四、查看开机启动消息
[@ltv_125 rec_multiudp_to_file]# dmesg 
Linux version 2.6.18-274.el5  (gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)) #1 SMP Fri Jul 8 17:36:59 EDT 2011
Command line: ro root=LABEL=/
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000010000 - 000000000009c000 (usable)
 BIOS-e820: 0000000000100000 - 00000000cd2f0000 (usable)
 BIOS-e820: 00000000cd2f0000 - 00000000cd31c000 (reserved)
 BIOS-e820: 00000000cd31c000 - 00000000cd35b000 (ACPI data)
 BIOS-e820: 00000000cd35b000 - 00000000d0000000 (reserved)
 BIOS-e820: 00000000e0000000 - 00000000f0000000 (reserved)
 BIOS-e820: 00000000fe000000 - 0000000100000000 (reserved)
 BIOS-e820: 0000000100000000 - 0000000830000000 (usable)

五、芯片信息
1. $ lspci -v


2. $ dmidecode
Dmidecode 这款软件允许你在 Linux 系统下获取有关硬件方面的信息。
Dmidecode 遵循 SMBIOS/DMI 标准,其输出的信息包括 BIOS、系统、主板、处理器、内存、缓存等等

Usage: dmidecode [OPTIONS]
Options are:
-d, --dev-mem FILE Read memory from device FILE (default: /dev/mem)
  从设备文件读信息,输出内容与不加参数标准输出相同

-h, --help Display this help text and exit
显示帮助信息

-q, --quiet Less verbose output
显示更少的简化信息

-s, --string KEYWORD Only display the value of the given DMI string
只显示指定DMI字符串的信息

-t, --type TYPE Only display the entries of given type
只显示指定条目的信息

-u, --dump Do not decode the entries
显示未解码的原始条目内容
--dump-bin FILE Dump the DMI data to a binary file
--from-dump FILE Read the DMI data from a binary file
-V, --version Display the version and exit

​显示版本信息

2.1 dmidecode参数string及type列表
(1)Valid string keywords are:
bios-vendor
bios-version
bios-release-date
system-manufacturer
system-product-name
system-version
system-serial-number
system-uuid
baseboard-manufacturer
baseboard-product-name
baseboard-version
baseboard-serial-number
baseboard-asset-tag
chassis-manufacturer
chassis-type
chassis-version
chassis-serial-number
chassis-asset-tag
processor-family
processor-manufacturer
processor-version
processor-frequency
(2)Valid type keywords are:
bios
system
baseboard
chassis
processor
memory
Cache
connector
slot
(3)type全部编码列表
0 BIOS
1 System
2 Base Board
3 Chassis
4 Processor
5 Memory Controller
6 Memory Module
7 Cache
8 Port Connector
9 System Slots
10 On Board Devices
11 OEM Strings
12 System Configuration Options
13 BIOS Language
14 Group Associations
15 System Event Log
16 Physical Memory Array
17 Memory Device
18 32-bit Memory Error
19 Memory Array Mapped Address
20 Memory Device Mapped Address
21 Built-in Pointing Device
22 Portable Battery
23 System Reset
24 Hardware Security
25 System Power Controls
26 Voltage Probe
27 Cooling Device
28 Temperature Probe
29 Electrical Current Probe
30 Out-of-band Remote Access
31 Boot Integrity Services
32 System Boot
33 64-bit Memory Error
34 Management Device
35 Management Device Component
36 Management Device Threshold Data
37 Memory Channel
38 IPMI Device
39 Power Supply
40 Additional Information
41 Onboard Device


2.2 命令用法示例
查看服务器型号:dmidecode | grep 'Product Name'
查看主板的序列号:dmidecode |grep 'Serial Number'
查看系统序列号:dmidecode -s system-serial-number
查看内存信息:dmidecode -t memory
查看OEM信息:dmidecode -t 11

关于 Dmidecode 的更多用法,你可以通过指定 -h 选项查询
不带选项执行 dmidecode 通常会输出所有的硬件信息。

Dmidecode 有个很有用的选项 -t,可以按指定类型输出相关信息,
假如要获得处理器方面的信息,
则可以执行:
$ dmidecode -t processor

你可能感兴趣的:(linux查看硬件相关信息)