User Tools

Site Tools


linux:linux_memory_swap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:linux_memory_swap [2021/02/11 16:15]
manu created
linux:linux_memory_swap [2021/02/11 16:35] (current)
manu [List memory inuse]
Line 1: Line 1:
 ====== Linux Swap and memory ====== ====== Linux Swap and memory ======
 +
 +===== List memory inuse =====
 +
 +You can use **free [-h|-k|-m|-g]**
 +<cli prompt='#'>​
 +opensuse:~ # free -h
 +              total        used        free      shared ​ buff/​cache ​  ​available
 +Mem:           ​15Gi ​       10Gi       ​1.2Gi ​      ​1.4Gi ​      ​3.9Gi ​      3.4Gi
 +Swap:           ​9Gi ​         0B         9Gi
 +opensuse:~ # free
 +              total        used        free      shared ​ buff/​cache ​  ​available
 +Mem:       ​16289016 ​   10924400 ​    ​1259800 ​    ​1440724 ​    ​4104816 ​    ​3600328
 +Swap:      10485756 ​          ​0 ​   10485756
 +</​cli>​
 +
 +Memory available
 +<cli prompt='#'>​
 +opensuse:~ # cat /​proc/​meminfo ​
 +MemTotal: ​      ​16289016 kB
 +MemFree: ​        ​1077280 kB
 +MemAvailable: ​   3419608 kB
 +Buffers: ​         141848 kB
 +Cached: ​         3983768 kB
 +SwapCached: ​           0 kB
 +...
 +</​cli>​
 +
 +Swap available
 +<cli prompt='#'>​
 +opensuse:~ # swapon -s
 +Filename ​                               Type            Size    Used    Priority
 +/​dev/​sda5 ​                              ​partition ​      ​10485756 ​       0       -1
 +</​cli>​
 +<cli prompt='#'>​
 +opensuse:~ # cat /proc/swaps
 +Filename ​                               Type            Size    Used    Priority
 +/​dev/​sda5 ​                              ​partition ​      ​10485756 ​       0       -1
 +</​cli>​
  
 ===== Clear / clean swap ===== ===== Clear / clean swap =====
Line 16: Line 54:
 <cli prompt='#'>​ <cli prompt='#'>​
 # sync; echo 3 > /​proc/​sys/​vm/​drop_caches ​ # sync; echo 3 > /​proc/​sys/​vm/​drop_caches ​
 +</​cli>​
 +
 +**Another way**
 +
 +If you want to clear Swap space, you may like to run the below command.
 +<cli prompt='#'>​
 +# swapoff -a && swapon -a
 </​cli>​ </​cli>​
linux/linux_memory_swap.1613056529.txt.gz ยท Last modified: 2021/02/11 16:15 by manu