Notes & TILs
Search…
Get Total System Memory using `vmstat` command
Posted on 31 May 2020
1
vmstat -s | grep "total memory" | grep -Eo '[0-9]{1,}'
Copied!
This will print the total memory (your RAM) in highlighted text.
The command vmstat -s is usually used to print memory statistics a sample output might look like
1
1882140 K total memory
2
644068 K used memory
3
861172 K active memory
4
653200 K inactive memory
5
217160 K free memory
6
55140 K buffer memory
7
965772 K swap cache
8
2097148 K total swap
9
230400 K used swap
10
1866748 K free swap
11
169316 non-nice user cpu ticks
12
4939 nice user cpu ticks
13
37944 system cpu ticks
14
666678 idle cpu ticks
15
53315 IO-wait cpu ticks
16
0 IRQ cpu ticks
17
693 softirq cpu ticks
18
0 stolen cpu ticks
19
2554778 pages paged in
20
1429680 pages paged out
21
40722 pages swapped in
22
191481 pages swapped out
23
3487312 interrupts
24
10042547 CPU context switches
25
1590932382 boot time
26
9975 forks
Copied!
Last modified 1mo ago
Copy link