hf models, datasets, and spaces ls lists files by repo ID
Introduced 2026-04-30 · score 0.98
HOW TO USE IT
When inspecting a Hugging Face Hub repository, pass its repo ID to `hf models ls`, `hf datasets ls`, or `hf spaces ls` to list files. Add `--tree`, `-R`, `-h`, or `--revision <revision>` to adjust the listing.
hf models ls <owner>/<model> --tree -hhf datasets ls <owner>/<dataset> -R -hhf spaces ls <owner>/<space> --tree -R -hWHY THIS HELPS
When inspecting a Hub repository during code work, list its files and optionally view them recursively, as a tree, with human-readable sizes, or at a revision.
BEFORE THIS CHANGE
Use `hf models ls`, `hf datasets ls`, or `hf spaces ls` to list repos; use `hf buckets ls <bucket_id>` to list files in a bucket.
REQUIREMENTS AND LIMITATIONS
- Version: v1.13.0
- REPO_ID: Model, dataset, or Space ID; when supplied, lists files in that repo. Without it, lists Hub repositories of that type.
- --tree: List files in tree format; applies only to file listings.
- -R, --recursive: List files recursively; applies only to file listings.
- -h, --human-readable: Show sizes in human-readable format; applies only to file listings.
- --revision TEXT: Select a Git revision by branch name, tag, or commit hash.
- Prerequisite: Install the `hf` CLI; it is included with `huggingface_hub` or can be installed with the standalone installer. The docs do not state an auth prerequisite for public repo file listings.
FIRST-PARTY EVIDENCE
- https://github.com/huggingface/huggingface_hub/releases/tag/v1.13.0
- https://github.com/huggingface/huggingface_hub/pull/4166
- https://github.com/huggingface/huggingface_hub/blob/v1.13.0/docs/source/en/guides/cli.md
- https://github.com/huggingface/huggingface_hub/blob/v1.13.0/docs/source/en/package_reference/cli.md
Check the installed version and the source before using it. Entry JSON