← 返回命令列表

Linux command

nix-collect-garbage 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Collect garbage

nix-collect-garbage

Delete old generations

nix-collect-garbage -d

Delete generations older than days

nix-collect-garbage --delete-older-than [30d]

Dry run

nix-collect-garbage --dry-run

说明

nix-collect-garbage removes unreferenced store paths from the Nix store. Frees disk space by deleting packages not linked from any profile or garbage collection root.

参数

-d, --delete-old
Delete old profile generations.
--delete-older-than _period_
Delete generations older than period.
--dry-run
Show what would be deleted.
--max-freed _bytes_
Stop after freeing bytes.

FAQ

What is the nix-collect-garbage command used for?

nix-collect-garbage removes unreferenced store paths from the Nix store. Frees disk space by deleting packages not linked from any profile or garbage collection root.

How do I run a basic nix-collect-garbage example?

Run `nix-collect-garbage` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -d, --delete-old do in nix-collect-garbage?

Delete old profile generations.