Advance

Clear cache, buffer and Swap in Linux [Best]

Clear cache, buffer and Swap in Linux
1
(1)

As you know any operating system performs its processes and also increases the operating speed of system use from cache, buffer &, etc. Linux is no exception and maybe it can be said that it uses this subject much better than other operating systems. Accordingly to manage and clear the cache,  buffer, and swap in Linux, provide a solution for your users to delete if needed. Now In this article, we are going to teach commands and solutions for Clear cache, buffer, and swap in Linux. Use them if you need or fill the RAM and slow down the system to empty more space in the RAM. It should note that you can visit the packages available in Eldernode to purchase a Linux VPS server.

Tutorial Clear cache, Buffer, and Swap in Linux

Follow us on how to clear memory cache, buffer, and swap in Linux.

Recommended Article: How to Setup CyberPanel on Ubuntu 20.04

What is Clear cache, Buffer, and Swap?

The cache is a type of SRAM or DRAM memory. This memory is using to prevent processing time delays between the processor and the computer’s RAM. Memory cache usually has less capacity and faster speed than other memory used in computers.

A Buffer is a temporary location for storing data from a specific application that is not using by other applications. Buffer is like the concept of bandwidth. When you try to pass a large amount of data through a network that the network card is unable to pass (ie does not have the required speed), the network card holds that data as a buffer. By doing this, the data transfer will be done continuously and continuously at a lower speed.

Swap space is a part of the system hard drive that can introduce as a partition or file to the Linux kernel. When the Linux kernel needs more RAM, it uses the Swapping feature to copy the less-used parts of the RAM into the swap space and create free space for itself in the RAM. If the part of the RAM copied into the swap space is required, the reverse of the previous operation occurs, in other words, the Linux kernel uses the swap space as a complement to the RAM. Using Swap space in Linux allows systems with low RAM to run heavier programs. It should also note that copying from RAM to swap space and vice versa may slow down the system.

In the next section, join us to teach you how to clear memory cache, buffer, and swap in Linux.

How to Clear memory cache, buffer, and swap in Linux Server

There are three ways to remove cache, buffer, etc., which are:

1) To delete only PageCache, you can enter the following command :

sync; echo 1 > /proc/sys/vm/drop_caches  

2) Now if you need to delete Dentries and Inodes created, you must enter the command:

sync; echo 2 > /proc/sys/vm/drop_caches  

3) Finally, if you consider deleting all page Cache, Dentries, and Indoes, you must enter the command as follows:

sync; echo 3 > /proc/sys/vm/drop_caches  

In this way, you are familiar with the function of the Sync command and From now on, you can use it to clear the cache. Finally, it is worth noting that you can use this command at certain times and when a Linux server has not been restarted for a long time.

Note: Repeated use of this command may interrupt the performance of Linux and run kernel processes, so avoid using it continuously.

You can also use this command in Cron to automatically clear, after 24 or 48 hours of high pressure on the server.

Recommended Article: Clear cache, buffer and Swap in Linux [Best]

Conclusion

In this article, we tried to teach you useful information about Clear cache, buffer, and Swap in Linux. You can refer to the article How to add Swap Space on Ubuntu 20.04 if you wish.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

2 thoughts on “Clear cache, buffer and Swap in Linux [Best]

  1. It is pretty common for certain information from numerous websites to be kept in the form of cookies and caches while using any browser. Although these cookies and cache do not often affect browsing, it is nevertheless a good idea to erase such data sometimes. It is advised to remove cookies in Google Chrome to prevent any loading or formatting issues.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day