Whats the .local folder for in my Home Directory
What is the ~/.local
folder good for and is it safe to remove the content within this folder?
Solution 1:
This is a recent innovation, followed by Gnome and thus by Ubuntu, to store user-specific data in fixed directories. According to this document, there is
- a single directory where user data is stored, defaulting to
~/.local/share
; - a single directory where configuration is stored, defaulting to
~/.config
; - a single directory which holds non-essential data files, defaulting to
~/.cache
.
Historically, Unix programs were free to spread their data all over the $HOME
directory, putting their data in dot-files (files starting with ".") or subdirectories such as ~/.vimrc
and ~/.vim
. The new specification is intended to make this behavior more predictable. I suspect this makes backups of application data easier, in addition to giving your home directory a tidier appearance. Not all applications adhere to this standard yet.
In the .local
hierarchy, programs put user information such as emails and calendar events. You could manually remove this data, but then the program would lose its state; unless this is what you intend (e.g. when there is a problem with your configuration), you shouldn't remove or change files in that directory. With .cache
you can be more careless as the program should be able to recover - redownload or recompute - all the files if you remove them.
Solution 2:
Let me share one of my experiences about the .local directory. I also found my disk partition(root partition) which store home directory has no enough space, and after I check those directories' content, I found the .local directory stores above 70G space, then I want to delete it, but fear the deletion could cause my ubuntu system crash. So I searched this question in google, and it directs me here. But the previous answers could not solve my problems, I only want two results on my system:
Remove some content in the .local directory, then I could have enough disk space to store my new files;
I don't want my system crash, it means I don't want to directly delete the content from my home .local directory, it's too dangerous!
Finally, I found the biggest content under the .local directory is here: /home/myAccount/.local/share/Trash It occupies 69G Bytes. I feel it relates to the Trash, so I go to trash: trash:/// and empty the trash, Then I found the 69G bytes disk space was freed!!
So my conclusions:
It's highly risky to delete .local directory directly;
We could safely delete content under /home/myAccount/.local/share/Trash by "Empty" trash.
Solution 3:
The .local/ directory is used by some software to keep your preferences (as pointed by @loevborg). This directory is part of the effort to standardize the mess that is the $HOME
user. But unfortunately many software has not yet joined this effort, even some gnome software still are spreading your preferences in others directory (see .gnome2, .gconf, .evolution, etc).
It is not safe to remove the directory. Some apps store important information/config files inside this directory.