On the way to get a simple command to get a more free memory, here an example of a solution.

 

Under the bashrc_user file you have to add the following Line. (You can use other environments files)

 

alias freeram='echo "# Utilisation de la RAM:" && free -mt && sudo sysctl -w vm.drop_caches=3 > /dev/null && echo "# Nettoyage de la RAM:" && free -mt'

 

[wmediouni@database  ~]$ source .bashrc_user

[wmediouni@database  ~]$ freeram

# Utilisation de la RAM:

             total       used       free     shared    buffers     cached

Mem:          1876       1795         81        138        137        896

-/+ buffers/cache:        761       1115

Swap:         2047         81       1966

# Nettoyage de la RAM:

             total       used       free     shared    buffers     cached

Mem:          1876        893        983        138          0        158

-/+ buffers/cache:        734       1141

Swap:         2047         81       1966

[wmediouni@database  ~]$ cat .bashrc_user | grep freeram

alias freeram='echo "# Utilisation de la RAM:" && free -mt && sudo sysctl -w vm.drop_caches=3 > /dev/null && echo "# Nettoyage de la RAM:" && free -mt'

[wmediouni@database  ~]$

 

Then the "freeram" command can be added under cron if needed.

 

Hope This helps