# Linux Swap 分区相关命令
Date: 2019-11-03


- /proc/swaps 文件

```bash
# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       4194300 0       -2
```

- /proc/meminfo 文件

```bash
# grep Swap /proc/meminfo
SwapCached:            0 kB
SwapTotal:       4194300 kB
SwapFree:        4194300 kB

```

- swapon

```bash
# swapon -s 
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       4194300 0       -2
```

- free

free -g/-k/-m

```bash
# free -g
              total        used        free      shared  buff/cache   available
Mem:              1           0           0           0           1           1
Swap:             3           0           3

```

- vmstat

```bash
# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0      0 130536    172 1654888    0    0     0     3    1   23  0  0 100  0  0

```

- top/atop/htop/glance

### 参考引用

[How To Check Swap Usage Size and Utilization in Linux](https://www.cyberciti.biz/faq/linux-check-swap-usage-command/)

