Clear Linux Buff Cache
Linux Buff/Cache
Buffers
Memory used by kernel buffers (Buffers in /proc/meminfo
)
Cache
Memory used by the page cache and slabs (Cached and Reclaimable in /proc/meminfo
)
buff/cache
Sum of buffers and cache
Available
Estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the cache or free fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use (MemAvailable in /proc/meminfo, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free)
Credits to stackoverflow answer.
Clear Buff/Cache
|
|
sync
will flush the file system buffer, drop_cache
will clean cache without killing any application/service.
- Above
echo 3
is used to Clear PageCache, dentries and inodes. echo 2
to clear dentries and inodes.echo 1
to clear PageCache only.
Script & Crontab
Create a script file as root user.
|
|
Set execute permission.
|
|
Create a crontab entry.
|
|
Cron job to run daily at 1 AM.
|
|