Posts

How to Delete Buffers and Cache Memory in Linux

Step 1: Check Buffers & Cache Memory

To check the buffers and cache memory in linux, execute the following command:

# free
              total        used        free      shared  buff/cache   available
Mem:        1015944      211640       94724       57700      709580      562416
Swap:             0           0           0

Step 2: Check Buffers & Cache Memory

Now delete and check the buffers and cache memory it will be reduced:

# sync && echo 3 > /proc/sys/vm/drop_caches && free

Following are the Linux Kernal that how can we drop the various aspects of cached items by changing the numeric argument to the above command
To free pagecache:

# echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

# echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

# echo 3 > /proc/sys/vm/drop_caches

How to Clean History in linux

Step 1: Check the History

In order to check the executed shell commands in linux, use the history command

# history
  366  cd ..
  367  make
  368  cd posix-local/
  369  cd app/
  370  less Makefile
  371  ls -l
  372  cd bin/

Step 2: Clear the History

To clear all your history, use

# history -c

To delete a single line, use

# history -d linenumber