Files
cheatsheet-tldr/tldr/nix-collect-garbage
2025-10-05 00:20:58 +00:00

23 lines
636 B
Plaintext

---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# nix-collect-garbage
> 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>.
- Delete all store paths unused by current generations of each profile:
`nix-collect-garbage {{[-d|--delete-old]}}`
- Simulate the deletion of old store paths:
`nix-collect-garbage {{[-d|--delete-old]}} --dry-run`
- Delete all store paths older than 30 days:
`nix-collect-garbage --delete-older-than 30d`