![Forrest logo](/images/logo.png)
nix-store:tldr:7bbfe
Calculate the total size of a certain store path with all the dependencies.
$ du -cLsh $(nix-store --query --references ${-nix-store----})
try on your machine
The command du -cLsh $(nix-store --query --references ${-nix-store----})
is a complex command that is composed of two parts: du
and nix-store
.
-
du
command:du
is a Linux command used to estimate file and directory space usage.- The options used in this command are as follows:
-c
or--total
: Display a grand total.-L
or--dereference
: Dereference all symbolic links, showing the disk usage of the files they point to instead of reporting the disk usage of the symbolic links themselves.-s
or--summarize
: Display only a total for each specified file.-h
or--human-readable
: Print sizes in human-readable format (e.g., 1K, 234M, 2G).
-
nix-store
command:nix-store
is a tool from the Nix package manager that manages binary packages.- The options used in this command are as follows:
--query --references
: Query the Nix store to find all the references to a given path or hash.${-nix-store----}
: It is a placeholder that should be replaced with the path or hash of a package in the Nix store.
Overall, the command du -cLsh $(nix-store --query --references ${-nix-store----})
combines these two commands. It queries the Nix store for all references to a specific package and then uses du
to estimate the disk usage of all the files that are referenced by that package. The -cLsh
options of du
ensure that the disk usage is displayed in a summarized, human-readable format, and a grand total is provided at the end.
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.