nix-collect-garbage Command Examples

Delete unused and unreachable nix store paths. Generations can be listed using nix-env --list-generations. More information: https://nixos.org/manual/nix/stable/command-ref/nix-collect-garbage.html.

sudo nix-collect-garbage --delete-old

sudo nix-collect-garbage --delete-old --dry-run

sudo nix-collect-garbage --delete-older-than 30d