Score:-3

How to clear cache?

cn flag

Result of after entering free in terminal

ronay@MackbookPro:~$ free
              total        used        free      shared  buff/cache   available
Mem:        3893824     2748748      120040      164192     1025036      748844
Swap:       2097148      477604     1619544

How to clear cache here? I am new to ubuntu

David avatar
cn flag
Give a reason you need to clear the cache? Also what version of Ubuntu?
us flag
You don't need to. When you open a new program, the kernel will automatically clear the cache and allocate memory for that program.
24601 avatar
in flag
does [this reference](https://linuxhint.com/clear_cache_linux/) help explain?
Pronay Sarker avatar
cn flag
@David stream saying only 11GB is free, I want to install a game, that's why I am trying to free up my space without deleting anything.
Pronay Sarker avatar
cn flag
ubuntu 20.04.2LTS @David
David avatar
cn flag
The cache is memory not hard disk.
Pronay Sarker avatar
cn flag
@David can you say what's the free space in my Hard disk?
us flag
Open `Disks`. It would show the free space in each partition.
guiverc avatar
cn flag
Cache is RAM, the moment you use programs that need ram, the system will drop the cache & allocate it to whatever program request (`malloc()`) it. This is not not unique to Ubuntu; it is handled by the linux kernel (which differs in allocation to the BSD's MACH kernel used by the apple mac) but they are still somewhat similar.
Score:2
cn flag

You should not touch the cache. It is managed by the operating system.

Linux strives to maximize the use of fast RAM. Anything not needed for your applications will be used as temporary cache. Items written to disk will be kept in memory, so later on, if the item is needed again, it can be retrieved from fast memory rather than from slower disk, and so the program saving the file has done quickly with it and can continue to do other things. From the cache, the file is then committed to disk in the background.

That is why your free memory may be low on a linux system. However, that does not mean your applications will run out of memory. It is the column available that indicates the memory that is actually available for you. If more memory is required by applications, that will be taken from the free memory and from the cached memory. In addition, linux has also swap memory, i.e., memory of applications that are loaded, but not currently in use, may be stored on disk to free memory for active applications and a minimum of cache memory.

Thus, there is not any benefit in clearing the cache - it would slow down disk based operations. Better use unused memory for cache than leaving it free.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.