freeコマンドを使う。以下、表示例。
$ free total used free shared buff/cache available Mem: 1882344 ○○ ○○ ○○ ○○ ○○ Swap: 2002940 ○○ ○○
ubuntuのfreeコマンドはデフォルトではキビバイト単位で表示する。これをメガ単位で表示するには、--megaオプションを使う。
$ free --mega total used free shared buff/cache available Mem: 1882 ○○ ○○ ○○ ○○ ○○ Swap: 2002 ○○ ○○
デフォルトでは、物理メモリとスワップメモリを別々に表示するが、-tオプションを使うと物理メモリとスワップメモリの合計も一緒に表示する。
$ free --mega -t total used free shared buff/cache available Mem: 1882 ○○ ○○ ○○ ○○ ○○ Swap: 2002 ○○ ○○ Total: 3885 ○○ ○○