Click here for "Error Codes for Commercial Air Conditioners".

Display various information of memory

Display various information of memory

●Information about memory
To get information about memory, refer to the /proc/meminfo file.
This file is used as the memory information displayed by the top, free, and vmstat commands.

root@Lion:~# cat /proc/meminfo
MemTotal:        3977756 kB
MemFree:          468544 kB
MemAvailable:    1805372 kB
Buffers:           85952 kB
Cached:          1443148 kB
SwapCached:            0 kB
Active:          2671120 kB
Inactive:         579952 kB
Active(anon):    1766784 kB
Inactive(anon):    17020 kB
Active(file):     904336 kB
Inactive(file):   562932 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:       1717284 kB
Mapped:            78440 kB
Shmem:             61812 kB
Slab:             189912 kB
SReclaimable:     144328 kB
SUnreclaim:        45584 kB
KernelStack:        2496 kB
PageTables:         7136 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     1988876 kB
Committed_AS:    2286236 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:             1920 kB
HardwareCorrupted:     0 kB
AnonHugePages:   1603584 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      133124 kB
DirectMap2M:     3997696 kB

●Check memory usage.
To check the memory usage, use the free command.
When executed without options or with the -k option, the display will be in kilobytes; when executed with the -d option, it will be in bytes; and when executed with the -m option, it will be in megabytes.

root@Lion:~# free
total used free shared buffers cached
Mem: 1035140 544736 490404 0 47868 401036
-/+ buffers/cache: 95832 939308
Swap: 2097144 0 209714

Items displayed by the free command
total:Total memory capacity
used:Memory capacity in use
free:free memory space
shared:shared memory capacity
buffers:Disk buffer space used by the kernel
cached:Cache memory capacity

●Update and display memory usage at regular intervals.
If you need to monitor memory usage continuously, such as when you run a process that consumes a large amount of memory, you can update the memory usage status at regular intervals and display it.
To do this, add the option "-s" to the free command and specify the update time as an argument.

root@Lion:~# free -s5
total used free shared buffers cached

Mem: 1035140 385080 650060 0 24856 286260
-/+ buffers/cache: 73964 961176
Swap: 2097144 0 2097144

↓Five seconds elapsed.

total used free shared buffers cached

Mem: 1035140 385080 650060 0 24856 286268
-/+ buffers/cache: 73956 961184
Swap: 2097144 0 2097144

↓Five seconds elapsed.

total used free shared buffers cached
Mem: 1035140 385080 650060 0 24864 286260
-/+ buffers/cache: 73956 961184
Swap: 2097144 0 2097144
Copied title and URL