Computer Science Atlas
Tutorial

How to Check Memory Usage on Ubuntu

January 28, 2021
 

Step 1. Open a Terminal Session

If you're using an Ubuntu laptop or desktop, you can press Ctrl + Alt + T on your keyboard to open a new terminal window. If you're using a remote Ubuntu server, you can connect using SSH to open a new terminal session.

Step 2. Use the free Command

Bash
Copy
free -h
$
free -h

The -h option tells the command to show "human friendly" output (using familiar units like Gi for Gigabytes and Mi for Megabytes).

You should see output like:

Out
Copy
          total        used        free      shared  buff/cache   available
Mem:      1.9Gi       1.2Gi       146Mi        11Mi       637Mi       601Mi
Swap:        0B          0B          0B
          total        used        free      shared  buff/cache   available
Mem:      1.9Gi       1.2Gi       146Mi        11Mi       637Mi       601Mi
Swap:        0B          0B          0B

The first line (Mem:) shows the physical RAM available (total), used, and available (free).

The second line (Swap:) shows the amounts of swap memory.