Forrest logo
back to the nix-collect-garbage tool

nix-collect-garbage:tldr:16173

nix-collect-garbage: Delete all store paths older than 30 days.
$ sudo nix-collect-garbage --delete-older-than 30d
try on your machine

This command is used to perform garbage collection in a Nix package manager.

Here's how the command is broken down:

  • sudo: This keyword is used to execute the command with superuser or root privileges. It may request a password depending on system settings.
  • nix-collect-garbage: This is a command in Nix package manager that performs garbage collection. Garbage collection removes unnecessary or unused packages, profile generations, and old versions of packages, freeing up disk space.
  • --delete-older-than 30d: This is an option that specifies to delete all generations of packages and profiles that are older than 30 days (30d). In other words, it tells the garbage collector to delete all package and profile generations that were created more than 30 days ago.

Overall, the command sudo nix-collect-garbage --delete-older-than 30d is used to delete unused packages and profile generations older than 30 days in a Nix package manager.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the nix-collect-garbage tool