我忘记我的笔记本电脑上安装了多少个 RAM (DIMM) 模块。我不想拧开它,但想使用 bash 在控制台上查找它。我如何收集这些信息?
答案1
既然你没有提到,我假设这是在 Linux 上。以下任何一项都应该向您显示(具有 root 权限):
dmidecode -t memory
dmidecode -t 16
lshw -class memory
答案2
让我们为不太懂 shell 的用户提供方便:
sudo dmidecode -t memory | grep -i size
我的笔记本电脑上的输出将是:
Size: 2048 MB
Size: 1024 MB
...显示我安装了 1 个 1GB 模块和 1 个 2GB 模块。
答案3
就我而言,
sudo dmidecode -t 16
报告如下:
Handle 0x000A, DMI type 16, 23 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 16 GB
Error Information Handle: Not Provided
Number Of Devices: 2
我想指出的是,我的一个模块中只有 4 GiB RAM。该信息通过执行以下操作来显示:
sudo dmidecode -t 17
显示如下:
# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x000B, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x000A
Error Information Handle: Not Provided
Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: DIMM
Set: None
Locator: ChannelA-DIMM0
Bank Locator: BANK 0
Type: Unknown
Type Detail: None
Speed: Unknown
Manufacturer: Not Specified
Serial Number: Not Specified
Asset Tag: None
Part Number: Not Specified
Rank: Unknown
Configured Clock Speed: Unknown
Handle 0x000C, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x000A
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: SODIMM
Set: None
Locator: ChannelB-DIMM0
Bank Locator: BANK 2
Type: DDR3
Type Detail: Synchronous
Speed: 1600 MHz
Manufacturer: Hynix/Hyundai
Serial Number: 11111111
Asset Tag: None
Part Number: HMT351S6CFR8C-PB
Rank: Unknown
Configured Clock Speed: 1600 MHz
并且,如您所见,Bank 2 已满,而 Bank 0 为空。主板只有两个 RAM 插槽,但它们必须是双通道的。
答案4
[root@kr0 ~]# lsmem
RANGE SIZE STATE REMOVABLE BLOCK
0x0000000040000000-0x000000063fffffff 24G online yes 1-24
Memory block size: 1G
Total online memory: 24G
Total offline memory: 0B