답변:
이 게시물의 많은 솔루션은 운영 체제가 감지하는 메모리 양만 보여줍니다 (예 : PAE가없는 32 비트는 4GB 만 볼 수 있음)
sudo 권한이 있다고 가정하면 dmidecode
명령을 사용하여 메모리 슬롯의 양과 슬롯에 삽입 된 내용을 감지 할 수 있습니다 .
사용법 예 :
sudo dmidecode
또는 메모리 관련 정보에 대해서만 필터링하는 것이 좋습니다.
sudo dmidecode -t 17
내 경우의 출력 :
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x002F, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x002D
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: DIMM
Set: None
Locator: ChannelA_Dimm1
Bank Locator: ChannelA
Type: DDR3
Type Detail: Synchronous
Speed: 1333 MHz
Manufacturer: A-DATA
Serial Number: 0000762C
Asset Tag: ChannelA_Dimm1_AssetTag
Part Number: DDR3 1600G
Rank: 2
Configured Clock Speed: 1333 MHz
Handle 0x0031, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x002D
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: DIMM
Set: None
Locator: ChannelA_Dimm2
Bank Locator: ChannelA
Type: Unknown
Type Detail: Synchronous
Speed: Unknown
Manufacturer: ChannelA_Dimm2_Manufacturer
Serial Number: ChannelA_Dimm2_SerNum
Asset Tag: ChannelA_Dimm2_AssetTag
Part Number: ChannelA_Dimm2_PartNum
Rank: Unknown
Configured Clock Speed: Unknown
Handle 0x0033, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x002D
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: DIMM
Set: None
Locator: ChannelB_Dimm1
Bank Locator: ChannelB
Type: DDR3
Type Detail: Synchronous
Speed: 1333 MHz
Manufacturer: A-DATA
Serial Number: 000028C3
Asset Tag: ChannelB_Dimm1_AssetTag
Part Number: DDR3 1600G
Rank: 2
Configured Clock Speed: 1333 MHz
Handle 0x0035, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x002D
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: DIMM
Set: None
Locator: ChannelB_Dimm2
Bank Locator: ChannelB
Type: Unknown
Type Detail: Synchronous
Speed: Unknown
Manufacturer: ChannelB_Dimm2_Manufacturer
Serial Number: ChannelB_Dimm2_SerNum
Asset Tag: ChannelB_Dimm2_AssetTag
Part Number: ChannelB_Dimm2_PartNum
Rank: Unknown
Configured Clock Speed: Unknown
Handle 0x0037, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x002D
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: DIMM
Set: None
Locator: ChannelC_Dimm1
Bank Locator: ChannelC
Type: DDR3
Type Detail: Synchronous
Speed: 1333 MHz
Manufacturer: A-DATA
Serial Number: 000028E7
Asset Tag: ChannelC_Dimm1_AssetTag
Part Number: DDR3 1600G
Rank: 2
Configured Clock Speed: 1333 MHz
Handle 0x0039, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x002D
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: DIMM
Set: None
Locator: ChannelC_Dimm2
Bank Locator: ChannelC
Type: Unknown
Type Detail: Synchronous
Speed: Unknown
Manufacturer: ChannelC_Dimm2_Manufacturer
Serial Number: ChannelC_Dimm2_SerNum
Asset Tag: ChannelC_Dimm2_AssetTag
Part Number: ChannelC_Dimm2_PartNum
Rank: Unknown
Configured Clock Speed: Unknown
Handle 0x003B, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x002D
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: DIMM
Set: None
Locator: ChannelD_Dimm1
Bank Locator: ChannelD
Type: DDR3
Type Detail: Synchronous
Speed: 1333 MHz
Manufacturer: A-DATA
Serial Number: 000028F0
Asset Tag: ChannelD_Dimm1_AssetTag
Part Number: DDR3 1600G
Rank: 2
Configured Clock Speed: 1333 MHz
Handle 0x003D, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x002D
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: DIMM
Set: None
Locator: ChannelD_Dimm2
Bank Locator: ChannelD
Type: Unknown
Type Detail: Synchronous
Speed: Unknown
Manufacturer: ChannelD_Dimm2_Manufacturer
Serial Number: ChannelD_Dimm2_SerNum
Asset Tag: ChannelD_Dimm2_AssetTag
Part Number: ChannelD_Dimm2_PartNum
Rank: Unknown
Configured Clock Speed: Unknown
Invalid entry length (16). Fixed up to 11.
출력은 각각 4GB 메모리를 갖춘 8 개의 슬롯 (4 개가 사용 중)에 대해 알려줍니다.
sudo 권한이 있다고 가정하면 lshw
명령을 사용하여 메모리 슬롯의 양과 슬롯에 삽입 된 내용을 감지 할 수 있습니다 .
사용법 예 :
lshw
또는 메모리 관련 정보를 얻으려면 :
lshw -class memory
내 경우의 출력 :
*-firmware
description: BIOS
vendor: American Megatrends Inc.
physical id: 0
version: 3203
date: 11/26/2012
size: 64KiB
capacity: 8128KiB
capabilities: pci apm upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb biosbootspecification uefi
*-cache:0
description: L1 cache
physical id: 5
slot: L1-Cache
size: 32KiB
capacity: 32KiB
capabilities: internal write-back unified
configuration: level=1
*-cache:1
description: L2 cache
physical id: 6
slot: L2-Cache
size: 256KiB
capacity: 256KiB
capabilities: internal varies unified
configuration: level=2
*-cache:2
description: L3 cache
physical id: 7
slot: L3-Cache
size: 10MiB
capacity: 10MiB
capabilities: internal varies unified
configuration: level=3
*-memory
description: System Memory
physical id: 2d
slot: System board or motherboard
size: 16GiB
*-bank:0
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: DDR3 1600G
vendor: A-DATA
physical id: 0
serial: 0000762C
slot: ChannelA_Dimm1
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:1
description: DIMM Synchronous [empty]
product: ChannelA_Dimm2_PartNum
vendor: ChannelA_Dimm2_Manufacturer
physical id: 1
serial: ChannelA_Dimm2_SerNum
slot: ChannelA_Dimm2
width: 64 bits
*-bank:2
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: DDR3 1600G
vendor: A-DATA
physical id: 2
serial: 000028C3
slot: ChannelB_Dimm1
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:3
description: DIMM Synchronous [empty]
product: ChannelB_Dimm2_PartNum
vendor: ChannelB_Dimm2_Manufacturer
physical id: 3
serial: ChannelB_Dimm2_SerNum
slot: ChannelB_Dimm2
width: 64 bits
*-bank:4
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: DDR3 1600G
vendor: A-DATA
physical id: 4
serial: 000028E7
slot: ChannelC_Dimm1
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:5
description: DIMM Synchronous [empty]
product: ChannelC_Dimm2_PartNum
vendor: ChannelC_Dimm2_Manufacturer
physical id: 5
serial: ChannelC_Dimm2_SerNum
slot: ChannelC_Dimm2
width: 64 bits
*-bank:6
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: DDR3 1600G
vendor: A-DATA
physical id: 6
serial: 000028F0
slot: ChannelD_Dimm1
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:7
description: DIMM Synchronous [empty]
product: ChannelD_Dimm2_PartNum
vendor: ChannelD_Dimm2_Manufacturer
physical id: 7
serial: ChannelD_Dimm2_SerNum
slot: ChannelD_Dimm2
width: 64 bits
free
명령을 사용 하여 메모리에 대한 정보를 얻을 수 있습니다 .
사용법 예 :
free
산출:
total used free shared buff/cache available
Mem: 16374920 4653296 155360 9349708 11566264 1953928
Swap: 16715772 4060816 12654956
-h
보다 사람이 읽을 수있는 출력을 얻으려면 매개 변수를 추가하십시오.
total used free shared buff/cache available
Mem: 15G 4,4G 249M 8,9G 11G 1,9G
Swap: 15G 3,9G 12G
경우에 당신은 메모리 사용량이 결합 고려 모니터링 할 watch
과 free
같이 다음
watch free
이것은 free
위에서 본 정상적인 출력을 출력하지만 2 초마다 업데이트합니다 ( watch
)
/proc/meminfo
일부 메모리 정보를 얻는데도 사용할 수 있습니다 .
예:
cat /proc/meminfo
산출:
MemTotal: 16374920 kB
MemFree: 211408 kB
MemAvailable: 2036568 kB
Buffers: 34856 kB
Cached: 11248956 kB
SwapCached: 1572 kB
Active: 5451788 kB
Inactive: 10119984 kB
Active(anon): 4508180 kB
Inactive(anon): 9133120 kB
Active(file): 943608 kB
Inactive(file): 986864 kB
Unevictable: 13444 kB
Mlocked: 13444 kB
SwapTotal: 16715772 kB
SwapFree: 12654936 kB
Dirty: 1016 kB
Writeback: 0 kB
AnonPages: 4300076 kB
Mapped: 5466584 kB
Shmem: 9349796 kB
Slab: 309332 kB
SReclaimable: 230976 kB
SUnreclaim: 78356 kB
KernelStack: 17216 kB
PageTables: 77140 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 24903232 kB
Committed_AS: 28709200 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 1863680 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 737312 kB
DirectMap2M: 14934016 kB
DirectMap1G: 1048576 kB
@Serg가 지적했듯이 awk
출력을 가장 필수적인 것으로 축소하는 데 사용해야 합니다
예:
awk '/MemTotal/ || /SwapTotal/' /proc/meminfo
산출:
MemTotal: 16374920 kB
SwapTotal: 16715772 kB
vmstat
명령을 사용할 수도 있습니다 .
예:
vmstat
산출:
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 4060888 238300 35576 11506488 0 2 120 55 17 4 18 6 74 2 0
다음과 같이 더 읽기 쉽게 표시 될 수 있습니다.
vmstat -s -SM
산출:
15991 M total memory
4467 M used memory
5322 M active memory
9837 M inactive memory
253 M free memory
34 M buffer memory
11235 M swap cache
16323 M total swap
3965 M used swap
12358 M free swap
17691507 non-nice user cpu ticks
21078371 nice user cpu ticks
13384959 system cpu ticks
161496078 idle cpu ticks
4951342 IO-wait cpu ticks
0 IRQ cpu ticks
40582 softirq cpu ticks
0 stolen cpu ticks
263184336 pages paged in
119297582 pages paged out
1824 pages swapped in
1018199 pages swapped out
1111772384 interrupts
2371898713 CPU context switches
1473060064 boot time
1983609 forks
램 / 메모리 사용을 모니터링하는 데 도움이되는 몇 가지 도구가 있습니다. 여기에 이름을 드리겠습니다
top
그리고 htop
지속적으로 현재의 메모리 사용량을 업데이트 두 도구이다.
smem
공유 메모리의 사용량을 부분적으로 나눈 값을보고합니다.
예 (정렬) :
smem -r
산출:
7948 USERNAME /usr/lib/firefox/firefox 0 975580 997022 1027100
23748 USERNAME /usr/bin/perl /usr/bin/shut 0 456392 459957 472116
16341 USERNAME /opt/google/chrome/chrome - 0 401220 405063 419520
22977 USERNAME /home/fpoeck/.dropbox-dist/ 0 240332 240487 245712
23751 USERNAME /usr/bin/python /usr/share/ 0 204524 205538 214656
32449 USERNAME /usr/lib/thunderbird/thunde 0 191124 191657 200892
13531 USERNAME /opt/atom/atom --type=rende 0 124740 131853 144340
확인하는 좋은 방법은 /proc/meminfo
파일 을 참조하는 것 입니다. free, top, htop과 같은 대부분의 도구는 해당 파일을 사용합니다.
다른 통계를 보여주는 많은 행이 있지만 AWK를 사용하여 총계를 필터링 할 수 있습니다. MemTotal 줄에 RAM이 표시됩니다. 보너스로, 총 스왑도 포함되었습니다.
$ awk '/MemTotal/ || /SwapTotal/' /proc/meminfo
MemTotal: 1789444 kB
SwapTotal: 524284 k
나는 출력을 좋아한다 sudo dmidecode -t 17
. 내 컴퓨터에 대한 내용은 다음과 같습니다.
# dmidecode 2.12
# SMBIOS entry point at 0x000f0480
SMBIOS 2.7 present.
Handle 0x0009, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0007
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: DIMM
Set: None
Locator: A1_DIMM0
Bank Locator: A1_BANK0
Type: DDR3
Type Detail: Synchronous
Speed: 1333 MHz
Manufacturer: Undefined
Serial Number: 000001D2
Asset Tag: A1_AssetTagNum0
Part Number: SLA302G08-EDJ1C
Rank: 2
Configured Clock Speed: Unknown
Handle 0x000D, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0007
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: DIMM
Set: None
Locator: A1_DIMM2
Bank Locator: A1_BANK2
Type: DDR3
Type Detail: Synchronous
Speed: 1333 MHz
Manufacturer: Undefined
Serial Number: 0000017F
Asset Tag: A1_AssetTagNum2
Part Number: SLA302G08-EDJ1C
Rank: 2
Configured Clock Speed: 2 MHz
나는 그것이 당신에게 각 슬롯에 얼마나 많은 RAM이 있는지에 대한 인간이 읽을 수있는 간단한 설명을 제공한다는 사실을 좋아합니다. Size: 4096 MB
위의 예에서 2 x (따라서 총 8GB RAM이 있습니다). 슬롯별로 분류되므로 업그레이드 옵션이 무엇인지 조금 더 알 수 있습니다.
dmidecode
( man page )는 시스템 하드웨어에 대해 알려줍니다. -t 17
"메모리 장치"유형으로 필터 지정