Andrew Fletcher published: 31 August 2022 1 minute read
At first, I attempted
echo 1 > /proc/sys/vm/drop_caches
Response
-bash: /proc/sys/vm/drop_caches: Permission denied
Adding sudo in front of the command was met with the same result. What about if I execute the shell as root
sudo sh -c 'echo 1 > /proc/sys/vm/drop_caches'
Success. Caches cleared.
Different types of clearing cache
Clear PageCache only
sudo sh -c 'echo 1 > /proc/sys/vm/drop_caches'
Clear dentries and inodes
sudo sh -c 'echo 2 > /proc/sys/vm/drop_caches'
Clear pagecache, dentries, and inodes
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
Related articles
Andrew Fletcher
•
06 Jan 2025
How to set up password authentication with Apache or Nginx on Ubuntu
Securing sensitive content is essential for protecting data integrity and user privacy. One effective way to implement security is by restricting access to specific directories or resources using either Apache or Nginx authentication tools. This provides a comprehensive reference for configuring...
Andrew Fletcher
•
21 Nov 2024
How to update your Ubuntu server efficiently
Maintaining your Ubuntu server is essential to ensure it operates smoothly, stays secure, and benefits from the latest features. Whether you're managing a server for personal projects or enterprise-level applications, regularly updating your system is a critical best practice. Here’s a...
Andrew Fletcher
•
14 Nov 2024
Best practices for business efficiency and security in managing user accounts in Ubuntu
In today’s digital landscape, effective management of user accounts is pivotal for maintaining both operational efficiency and security within an organisation. Ubuntu, a popular Linux distribution, offers robust tools and commands that enable administrators to oversee user accounts seamlessly. This...