Linux

Ubuntu check ram size command line

Ubuntu check ram size command line





With studying on Ubuntu system, you may know already with ram and swap, if you want to know detail or size of using, what do you do to know those?

This is not difficult anymore our team work will share how to check information about ram and swap on Ubuntu system, need you to use command below.

This is to show size of using ram and swap on Ubuntu and it will show size to MB because you use -m if you use -g it will show size of ram and swap to Gigabyte.

$ free -m

Output:
twelveshow@twelveshow:~$ free -m
total used free shared buff/cache available
Mem: 2749 1039 1057 10 652 1548
Swap: 1897 0 1897


Flag provides detailed


$ vmstat -s

Output
2815460 K total memory
1064640 K used memory
1250712 K active memory
322864 K inactive memory
1082552 K free memory
48548 K buffer memory
619720 K swap cache
1942896 K total swap
0 K used swap
1942896 K free swap
22982 non-nice user cpu ticks
3101 nice user cpu ticks
7358 system cpu ticks
427051 idle cpu ticks
9013 IO-wait cpu ticks
0 IRQ cpu ticks
233 softirq cpu ticks
0 stolen cpu ticks
623484 pages paged in
109144 pages paged out
0 pages swapped in
0 pages swapped out
353354 interrupts
693289 CPU context switches
1559648642 boot time
2473 forks


extract ram and swap from /proc file system.

$ cat /proc/meminfo

Output
root@twelveshow:~# cat /proc/meminfo
MemTotal: 2815460 kB
MemFree: 1079668 kB
MemAvailable: 1583644 kB
Buffers: 48584 kB
Cached: 580704 kB
SwapCached: 0 kB
Active: 1252716 kB
Inactive: 323400 kB
Active(anon): 947704 kB
Inactive(anon): 9744 kB
Active(file): 305012 kB
Inactive(file): 313656 kB
Unevictable: 16 kB
Mlocked: 16 kB
SwapTotal: 1942896 kB
SwapFree: 1942896 kB
Dirty: 236 kB
Writeback: 0 kB
AnonPages: 946868 kB
Mapped: 292640 kB
Shmem: 10624 kB
Slab: 73288 kB
SReclaimable: 39772 kB
SUnreclaim: 33516 kB
KernelStack: 8496 kB
PageTables: 42424 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 3350624 kB
Committed_AS: 4656392 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 118720 kB
DirectMap2M: 2764800 kB

Show ram information

$ sudo dmidecode -t 17

Output
twelveshow@twelveshow:~$ sudo dmidecode -t 17
dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.5 present.

Conclusion
These way we hope that it will help you to check the detail information of ram and swap on Ubuntu system.

Leave a Reply

Your email address will not be published. Required fields are marked *

Most Popular

To Top