How to monitor system memory and swap utilization on Ubuntu Server 20.04

In the last post, we used commands top and vmstat to monitor CPU utilization. These commands also provided details of memory usage.

Step 1 : Run the top command and check for the Mem and Swap rows

Step 2 : You can query memory statistics for a specific PID or program by using the pidstat command.

Step 3 : Next, we will go through the vmstat command.

Step 4 : Another handy command is free

Step 5 : Finally, command sar can give you periodic reports of memory utilization.

The following command will query the current memory (-r) and swap (-S) utilization