Hugging Face CLI (hf) Reference Guide
The hf command is the modern command-line interface for interacting with the Hugging Face Hub, providing tools to manage repositories, models, datasets, and Spaces.
IMPORTANT: The hf command replaces the now deprecated huggingface-cli command.
Quick Start
- Installation:
curl -LsSf https://hf.co/cli/install.sh | bash -s
- Help: Use
hf --help to view all available functions and real-world examples.
- Authentication: Recommended via
HF_TOKEN environment variable or the --token flag.
Core Commands
General Operations
hf download REPO_ID: Download files from the Hub.
hf upload REPO_ID: Upload files/folders (recommended for single-commit; also handles resumable uploads of large directories).
hf upload-large-folder REPO_ID LOCAL_PATH: [Deprecated] — use hf upload instead.
hf sync: Sync files between a local directory and a bucket.
hf env / hf version: View environment and version details.
Authentication (hf auth)
login / logout: Manage sessions using tokens from huggingface.co/settings/tokens.
list / switch: Manage and toggle between multiple stored access tokens.
whoami: Identify the currently logged-in account.
Repository Management (hf repos)
create / delete: Create or permanently remove repositories.
duplicate: Clone a model, dataset, or Space to a new ID.
move: Transfer a repository between namespaces.
branch / tag: Manage Git-like references.
delete-files: Remove specific files using patterns.
Specialized Hub Interactions
Datasets & Models
- Datasets:
hf datasets list, info, and parquet (list parquet URLs).
- SQL Queries:
hf datasets sql SQL — Execute raw SQL via DuckDB against dataset parquet URLs.
- Models:
hf models list and info.
- Papers:
hf papers ls — View daily papers.
Discussions & Pull Requests (hf discussions)
- Manage the lifecycle of Hub contributions:
list, create, info, comment, close, reopen, and rename.
diff: View changes in a PR.
merge: Finalize pull requests.
Infrastructure & Compute
- Endpoints: Deploy and manage Inference Endpoints (
deploy, pause, resume, scale-to-zero, catalog).
- Jobs: Run compute tasks on HF infrastructure. Includes
hf jobs uv for running Python scripts with inline dependencies and stats for resource monitoring.
- Spaces: Manage interactive apps. Includes
dev-mode and hot-reload for Python files without full restarts.
Storage & Automation
- Buckets: Full S3-like bucket management (
create, cp, mv, rm, sync).
- Cache: Manage local storage with
list, prune (remove detached revisions), and verify (checksum checks).
- Webhooks: Automate workflows by managing Hub webhooks (
create, watch, enable/disable).
- Collections: Organize Hub items into collections (
add-item, update, list).
Advanced Usage & Tips
Global Flags
--format json: Produces machine-readable output for automation.
-q / --quiet: Limits output to IDs only.
Extensions & Skills
- Extensions: Extend CLI functionality via GitHub repositories using
hf extensions install REPO_ID.
- Skills: Manage AI assistant skills with
hf skills add.
Source: NousResearch/hermes-agent → skills/mlops/huggingface-hub/SKILL.md
1---2name: huggingface-hub3description: HuggingFace hf CLI: search/download/upload models, datasets.4---5
6
7# Hugging Face CLI (`hf`) Reference Guide
8
9The `hf` command is the modern command-line interface for interacting with the Hugging Face Hub, providing tools to manage repositories, models, datasets, and Spaces.
10
11> **IMPORTANT:** The `hf` command replaces the now deprecated `huggingface-cli` command.
12
13## Quick Start
14* **Installation:** `curl -LsSf https://hf.co/cli/install.sh | bash -s`
15* **Help:** Use `hf --help` to view all available functions and real-world examples.
16* **Authentication:** Recommended via `HF_TOKEN` environment variable or the `--token` flag.
17
18---
19
20## Core Commands
21
22### General Operations
23* `hf download REPO_ID`: Download files from the Hub.
24* `hf upload REPO_ID`: Upload files/folders (recommended for single-commit; also handles resumable uploads of large directories).
25* `hf upload-large-folder REPO_ID LOCAL_PATH`: **[Deprecated]** — use `hf upload` instead.
26* `hf sync`: Sync files between a local directory and a bucket.
27* `hf env` / `hf version`: View environment and version details.
28
29### Authentication (`hf auth`)
30* `login` / `logout`: Manage sessions using tokens from [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens).
31* `list` / `switch`: Manage and toggle between multiple stored access tokens.
32* `whoami`: Identify the currently logged-in account.
33
34### Repository Management (`hf repos`)
35* `create` / `delete`: Create or permanently remove repositories.
36* `duplicate`: Clone a model, dataset, or Space to a new ID.
37* `move`: Transfer a repository between namespaces.
38* `branch` / `tag`: Manage Git-like references.
39* `delete-files`: Remove specific files using patterns.
40
41---
42
43## Specialized Hub Interactions
44
45### Datasets & Models
46* **Datasets:** `hf datasets list`, `info`, and `parquet` (list parquet URLs).
47* **SQL Queries:** `hf datasets sql SQL` — Execute raw SQL via DuckDB against dataset parquet URLs.
48* **Models:** `hf models list` and `info`.
49* **Papers:** `hf papers ls` — View daily papers.
50
51### Discussions & Pull Requests (`hf discussions`)
52* Manage the lifecycle of Hub contributions: `list`, `create`, `info`, `comment`, `close`, `reopen`, and `rename`.
53* `diff`: View changes in a PR.
54* `merge`: Finalize pull requests.
55
56### Infrastructure & Compute
57* **Endpoints:** Deploy and manage Inference Endpoints (`deploy`, `pause`, `resume`, `scale-to-zero`, `catalog`).
58* **Jobs:** Run compute tasks on HF infrastructure. Includes `hf jobs uv` for running Python scripts with inline dependencies and `stats` for resource monitoring.
59* **Spaces:** Manage interactive apps. Includes `dev-mode` and `hot-reload` for Python files without full restarts.
60
61### Storage & Automation
62* **Buckets:** Full S3-like bucket management (`create`, `cp`, `mv`, `rm`, `sync`).
63* **Cache:** Manage local storage with `list`, `prune` (remove detached revisions), and `verify` (checksum checks).
64* **Webhooks:** Automate workflows by managing Hub webhooks (`create`, `watch`, `enable`/`disable`).
65* **Collections:** Organize Hub items into collections (`add-item`, `update`, `list`).
66
67---
68
69## Advanced Usage & Tips
70
71### Global Flags
72* `--format json`: Produces machine-readable output for automation.
73* `-q` / `--quiet`: Limits output to IDs only.
74
75### Extensions & Skills
76* **Extensions:** Extend CLI functionality via GitHub repositories using `hf extensions install REPO_ID`.
77* **Skills:** Manage AI assistant skills with `hf skills add`.
78
79---
80
81**Source:** [`NousResearch/hermes-agent`](https://github.com/NousResearch/hermes-agent) → `skills/mlops/huggingface-hub/SKILL.md`