Ram and swap relation

Hello everone

i have 8 GB of ram when i open multi app and it come closer to the max amount of available ram it start to use the swap which expected but when i close some of the apps or all of them i still see there some part of the swap used

so the question is:

  1. does it take sometime to convert those swap used to ram again or not and if does how long?
  2. is there command to control that ?

thanks for your time and have a nice day :slight_smile:


When swap is used, it shows the amount, but it doesn’t go down to zero. The system might not be using it, but it will still show a value. You can reset it yourself by turning swap off and then back again. For example, if /dev/sda1 is your swap, then you would do:

swapoff /dev/sda1

and then you will have no swap, and to enable swap again:

swapon /dev/sda1

then swap will show as zero swap memory being used, until the next time your system needs to use swap again. To be honest, it’s not really needed to do this, but that is how you would do it if you wanted.

1 Like

thanks alot @iwalker

it was decrease but never to zero as you said which confused me

and your explanation was very helpful

thanks again and have a nice day :slight_smile:

1 Like