![Forrest logo](/images/logo.png)
nix-store:tldr:3aedb
The nix-store --gc
is a command that is used in the Nix package manager to perform garbage collection.
In Nix, every package that is installed on the system is stored in the Nix store - a directory where all the packages are stored as unique entities based on their content hash. Over time, as new versions of packages are installed, older versions may become unused, leading to disk space wastage.
The --gc
option stands for garbage collection, which is a process to remove any unreferenced or unused packages from the Nix store, freeing up disk space.
When you run nix-store --gc
, Nix identifies and removes any packages that are not referenced by any other packages, thus eliminating unnecessary files and freeing up disk space. This command helps to keep the Nix store clean and efficient.
It is a good practice to periodically run nix-store --gc
to ensure that your system does not accumulate unnecessary packages and uses disk space optimally.