we can use The free command is used to display amount of free and used memory in the system. The command also displays the total amount of swap memory in the system and buffers and caches used by the Linux kernel.
free -m
and to Clear memory we can use :
To clear pagecache only:
sync; echo 1 > /proc/sys/vm/drop_caches
To clear dentries and inodes:
sync; echo 2 > /proc/sys/vm/drop_caches
To clear pagecache, dentries and inodes:
sync; echo 3 > /proc/sys/vm/drop_caches
to empty buffer and cache:
free && sync && echo 3 > /proc/sys/vm/drop_caches && free
if you has this probleme of permission
bash: /proc/sys/vm/drop_caches: Permission denied
you can use echo piped to sudo tee to allow the proper permission needed when you need to echo as root
echo 3 | sudo tee /proc/sys/vm/drop_caches
Top comments (0)