Home Explore Blog Models CI



nix

1st chunk of `src/nix/nar-ls.md`
0117950f5158e7af0b0df7fedcad8090e67f3dc7de579c47000000010000022d
R""(

# Examples

* To list a specific file in a [NAR][Nix Archive]:

  ```console
  # nix nar ls --long ./hello.nar /bin/hello
  -r-xr-xr-x                38184 hello
  ```

* To recursively list the contents of a directory inside a NAR, in JSON
  format:

  ```console
  # nix nar ls --json --recursive ./hello.nar /bin
  {"type":"directory","entries":{"hello":{"type":"regular","size":38184,"executable":true,"narOffset":400}}}
  ```

# Description

This command shows information about a *path* inside [Nix Archive (NAR)][Nix Archive] file *nar*.


)""

Title: nix nar ls Command: Listing Contents of Nix Archives
Summary
The `nix nar ls` command is used to display information about a specified path within a Nix Archive (NAR) file. It supports listing specific files, and can recursively list the contents of directories. Options include `--long` for detailed output and `--json` for machine-readable JSON format, as demonstrated by examples for listing a single file or a directory's contents.