Knowledge base
  • Goal of knowledge base
  • Linux & core
    • Linux
      • Record SSH session for reporting
      • Compress / Decompress files
      • Colorize logs
      • Cron output & logging
      • Signal
      • Break out and escape SSH session
      • Mount volume permanently
      • Show processes most consuming CPU & MEM
      • Improve and optimize battery life on Linux
      • File ownership & groups in linux
      • Automatic security update/patch on Ubuntu
      • Clean buffers and cached on linux
      • Bash completion on Linux/Mac
    • Core services
      • Nginx reload
      • OpenVPN Split tunneling
      • Nmap commands
    • Hardware
      • CPU Architecture fundamental
  • Database
    • MySQL
      • InnoDB - innodb_file_per_table parameter
      • MySQL - enable slow query log
      • MySQL - export large tables
    • MongoDB
  • Container
    • Docker
      • ADD or COPY in Dockerfile
        • Clean data of docker completely
    • Podman
  • Automation
    • Ansible
      • Output format
  • Build & Deployment
    • Jenkins
      • Jenkins - force exit pipeline when failure
  • Language & Toolset
    • PHP
      • Composer
      • php-redis & php-igbinary
  • Mindset
    • Technical based
      • Writing well
      • Reinvent The Wheel
      • Approach a new system
      • Backup philosophy
      • Mindset for building HA and scalable system
      • GitLab database incident
    • Non-technical based
      • How to read news efficiency?
      • How long should you nap?
      • Assume good faith
  • Reference & learning source
    • Books
      • Sysadmin/SRE
      • Mindsets
      • Software fundamentals
    • English
Powered by GitBook
On this page
  1. Linux & core
  2. Linux

Clean buffers and cached on linux

Need root permission

# clean buffer and cached
root@appv2-1:~# free -m && sync && echo 3 > /proc/sys/vm/drop_caches && free -m

# step by step
root@appv2-1:~# free -m
             total       used       free     shared    buffers     cached
Mem:          3951       3260        691          0         46        121
-/+ buffers/cache:       3092        859
Swap:         4095          0       4095

root@appv2-1:~# sync
root@appv2-1:~# echo 3 > /proc/sys/vm/drop_caches

root@appv2-1:~# free -m
             total       used       free     shared    buffers     cached
Mem:          3951       3065        886          0          2         22
-/+ buffers/cache:       3040        911
Swap:         4095          0       4095

Before:

  • buffers = 46 mb

  • cached = 121 mb

After

  • buffers = 2 mb

  • cached = 22 mb

PreviousAutomatic security update/patch on UbuntuNextBash completion on Linux/Mac

Last updated 6 years ago