# freeコマンド `free`は、メモリ(RAM)とスワップ領域の使用状況を確認するコマンド ## 基本構文 ``` free [OPTION]... ``` ## 使用例 ### 見やすい単位で表示 ``` free -h ``` - `-h`(`--human`)オプションを使用 - KiB, MiB, GiBなどの単位で表示 例: ``` ubuntu@mail.unchioshi.net:~$ free total used free shared buff/cache available Mem: 24608576 2130904 22008672 42364 920764 22477672 Swap: 0 0 0 ubuntu@mail.unchioshi.net:~$ free -h total used free shared buff/cache available Mem: 23Gi 2.0Gi 20Gi 41Mi 899Mi 21Gi Swap: 0B 0B 0B ubuntu@mail.unchioshi.net:~$ ``` ### 定期的に更新 ``` free -h -s 1 ``` - `-s`(`--seconds`)オプションを使用 - 指定した秒数ごとに表示 ## 出力の見方 ``` ubuntu@mail.unchioshi.net:~$ free -h total used free shared buff/cache available Mem: 23Gi 2.0Gi 20Gi 41Mi 899Mi 21Gi Swap: 0B 0B 0B ``` - `total` ... メモリの総容量 - `used` ... 使用中のメモリ - `free` ... 完全に未使用のメモリ - `shared` ... 主に共有メモリや`tmpfs`に使用されているメモリ - `buff/cache` ... バッファやキャッシュに使用されているメモリ - `available` ... 新しいアプリケーションが利用できるメモリの推定量