Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e43a03f8c | |||
| 22c5c8af83 | |||
| e30c0eb9cc | |||
| 131c1654ee | |||
| 931a3a9517 | |||
| e5c8b8e223 | |||
| 507ef7149b | |||
| 462a38b164 | |||
| 89e6296c94 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-cli",
|
"name": "obsidian-cli",
|
||||||
"description": "Interact with Obsidian vaults using the official Obsidian CLI (v1.12+). Read, create, append, search, and manage notes, daily notes, properties, tags, tasks, bookmarks, templates, themes, sync, plugins, and links — all from the terminal.",
|
"description": "Interact with Obsidian vaults using the official Obsidian CLI (v1.12+). Read, create, append, search, and manage notes, daily notes, properties, tags, tasks, bookmarks, templates, themes, sync, plugins, and links — all from the terminal.",
|
||||||
"version": "1.0.4",
|
"version": "1.2.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "pablo-mano"
|
"name": "pablo-mano"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -94,17 +94,16 @@ Add to your project's `.claude/settings.json`:
|
|||||||
|
|
||||||
Cursor has a native skills system (launched Feb 2026) that is directly compatible with the `SKILL.md` format — no rules file needed.
|
Cursor has a native skills system (launched Feb 2026) that is directly compatible with the `SKILL.md` format — no rules file needed.
|
||||||
|
|
||||||
**Option A — GitHub install (recommended):**
|
In a terminal:
|
||||||
1. Open Cursor Settings → Rules
|
|
||||||
2. Click **Add Rule** → **Remote Rule (GitHub)**
|
|
||||||
3. Paste `https://github.com/pablo-mano/Obsidian-CLI-skill`
|
|
||||||
4. Done — the skill auto-triggers on Obsidian-related tasks.
|
|
||||||
|
|
||||||
**Option B — Local copy:**
|
```bash
|
||||||
1. Clone or download this repo
|
git clone --depth 1 https://github.com/pablo-mano/Obsidian-CLI-skill /tmp/Obsidian-CLI-skill
|
||||||
2. Copy the folder into your project: `.cursor/skills/obsidian-cli/`
|
mkdir -p ~/.cursor/skills
|
||||||
(or globally: `~/.cursor/skills/obsidian-cli/`)
|
cp -r /tmp/Obsidian-CLI-skill/skills/obsidian-cli ~/.cursor/skills/obsidian-cli
|
||||||
3. Cursor picks it up automatically — no restart needed.
|
rm -rf /tmp/Obsidian-CLI-skill
|
||||||
|
```
|
||||||
|
|
||||||
|
Cursor picks it up automatically — no restart needed.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-cli",
|
"name": "obsidian-cli",
|
||||||
"description": "Interact with Obsidian vaults using the official Obsidian CLI (v1.12+). Read, create, append, search, and manage notes, daily notes, properties, tags, tasks, bookmarks, templates, themes, sync, plugins, and links — all from the terminal.",
|
"description": "Interact with Obsidian vaults using the official Obsidian CLI (v1.12+). Read, create, append, search, and manage notes, daily notes, properties, tags, tasks, bookmarks, templates, themes, sync, plugins, and links — all from the terminal.",
|
||||||
"version": "1.0.4",
|
"version": "1.2.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "pablo-mano"
|
"name": "pablo-mano"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -55,25 +55,31 @@ If omitted, the CLI targets the most recently active vault.
|
|||||||
|
|
||||||
## Command Overview
|
## Command Overview
|
||||||
|
|
||||||
The CLI provides **100+ commands** across these groups:
|
The CLI provides **130+ commands** across these groups:
|
||||||
|
|
||||||
| Group | Key Commands | Purpose |
|
| Group | Key Commands | Purpose |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| **files** | `read`, `create`, `append`, `prepend`, `move`, `delete`, `files`, `folders`, `file` | Note CRUD and file discovery |
|
| **files** | `read`, `create`, `append`, `prepend`, `move`, `rename`, `delete`, `files`, `folders`, `file`, `random` | Note CRUD and file discovery |
|
||||||
| **daily** | `daily`, `daily:read`, `daily:append`, `daily:prepend` | Daily note operations |
|
| **daily** | `daily`, `daily:read`, `daily:append`, `daily:prepend`, `daily:path` | Daily note operations |
|
||||||
| **search** | `search` | Full-text vault search with scoping and JSON output |
|
| **search** | `search`, `search:context` | Full-text search; `search:context` returns matching lines |
|
||||||
| **properties** | `properties`, `property:read`, `property:set`, `property:remove`, `aliases` | Frontmatter/metadata management |
|
| **properties** | `properties`, `property:read`, `property:set`, `property:remove`, `aliases` | Frontmatter/metadata management |
|
||||||
| **tags** | `tags`, `tag` | Tag listing, counts, and filtering |
|
| **tags** | `tags`, `tag` | Tag listing, counts, and filtering |
|
||||||
| **tasks** | `tasks`, `task` | Task querying, filtering, and toggling |
|
| **tasks** | `tasks`, `task` | Task querying, filtering, and toggling |
|
||||||
| **links** | `backlinks`, `links`, `unresolved`, `orphans`, `deadends` | Graph and link analysis |
|
| **links** | `backlinks`, `links`, `unresolved`, `orphans`, `deadends` | Graph and link analysis |
|
||||||
| **bookmarks** | `bookmarks` | Bookmark management |
|
| **bookmarks** | `bookmarks`, `bookmark` | List and add bookmarks |
|
||||||
| **templates** | `templates`, `template:read`, `template:insert` | Template listing, rendering, insertion |
|
| **templates** | `templates`, `template:read`, `template:insert` | Template listing, rendering, insertion |
|
||||||
| **plugins** | `plugins`, `plugin:enable`, `plugin:disable`, `plugin:install`, `plugin:reload` | Plugin management |
|
| **plugins** | `plugins`, `plugin`, `plugin:enable`, `plugin:disable`, `plugin:install`, `plugin:uninstall`, `plugins:restrict` | Plugin management |
|
||||||
| **sync** | `sync`, `sync:status`, `sync:history`, `sync:read`, `sync:restore`, `sync:deleted` | Obsidian Sync operations |
|
| **sync** | `sync`, `sync:status`, `sync:history`, `sync:read`, `sync:restore`, `sync:deleted` | Obsidian Sync operations |
|
||||||
| **themes** | `themes` | Theme management |
|
| **themes** | `themes`, `theme`, `theme:set`, `theme:install`, `theme:uninstall` | Theme management |
|
||||||
| **dev** | `dev:screenshot`, `eval`, `dev:console`, `dev:errors` | Developer/debugging tools |
|
| **snippets** | `snippets`, `snippets:enabled`, `snippet:enable`, `snippet:disable` | CSS snippet management |
|
||||||
| **vault** | `vault`, `vaults`, `version` | Vault info and metadata |
|
| **commands** | `commands`, `command`, `hotkeys`, `hotkey` | Execute Obsidian commands by ID; inspect hotkeys |
|
||||||
| **other** | `outline`, `wordcount`, `recents`, `reload` | Utility commands |
|
| **bases** | `bases`, `base:query`, `base:views`, `base:create` | Obsidian Bases (v1.12+ database feature) |
|
||||||
|
| **history** | `history`, `history:list`, `history:read`, `history:restore` | File version recovery (File Recovery plugin) |
|
||||||
|
| **workspace** | `workspace`, `tabs`, `tab:open` | Workspace layout and tab management |
|
||||||
|
| **diff** | `diff` | Compare local vs sync file versions |
|
||||||
|
| **dev** | `eval`, `dev:screenshot`, `dev:debug`, `dev:console`, `dev:errors`, `dev:css`, `dev:dom`, `devtools` | Developer/debugging tools |
|
||||||
|
| **vault** | `vault`, `vaults`, `version`, `reload`, `restart` | Vault info and app control |
|
||||||
|
| **other** | `outline`, `wordcount`, `recents` | Utility commands |
|
||||||
|
|
||||||
## Quick Reference — Most Common Commands
|
## Quick Reference — Most Common Commands
|
||||||
|
|
||||||
@@ -104,8 +110,8 @@ obsidian daily:prepend content="## Morning Notes"
|
|||||||
```bash
|
```bash
|
||||||
obsidian search query="project alpha"
|
obsidian search query="project alpha"
|
||||||
obsidian search query="TODO" path="projects" limit=10
|
obsidian search query="TODO" path="projects" limit=10
|
||||||
obsidian search query="meeting" format=json
|
obsidian search query="meeting" format=json # Returns JSON array of file paths
|
||||||
obsidian search query="urgent" matches case
|
obsidian search query="urgent" case
|
||||||
```
|
```
|
||||||
|
|
||||||
### Properties & Tags
|
### Properties & Tags
|
||||||
@@ -122,18 +128,20 @@ obsidian tag name="project/alpha"
|
|||||||
### Tasks
|
### Tasks
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian tasks # All incomplete tasks
|
obsidian tasks # All tasks (done + todo) — same as tasks all in v1.12
|
||||||
obsidian tasks all # All tasks (done + todo)
|
obsidian tasks all # All tasks (done + todo)
|
||||||
obsidian tasks done # Completed only
|
obsidian tasks done # Completed only
|
||||||
obsidian tasks daily # Tasks in today's daily note
|
obsidian tasks daily # Tasks in today's daily note
|
||||||
obsidian task path="note.md" line=12 toggle
|
obsidian task path="note.md" line=12 toggle
|
||||||
|
obsidian tasks | grep "\[ \]" # Workaround: filter to incomplete only
|
||||||
```
|
```
|
||||||
|
|
||||||
### Developer & Automation
|
### Developer & Automation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian eval code="app.vault.getFiles().length"
|
obsidian eval code="app.vault.getFiles().length"
|
||||||
obsidian dev:screenshot path="screenshot.png"
|
obsidian dev:screenshot path="folder/screenshot.png" # Path must be vault-relative
|
||||||
|
obsidian dev:debug on # Required before dev:console
|
||||||
obsidian dev:console limit=20
|
obsidian dev:console limit=20
|
||||||
obsidian dev:errors
|
obsidian dev:errors
|
||||||
```
|
```
|
||||||
@@ -178,7 +186,7 @@ obsidian daily:append content="- Started [[projects/new-feature|New Feature]]"
|
|||||||
```bash
|
```bash
|
||||||
obsidian files total # Total file count
|
obsidian files total # Total file count
|
||||||
obsidian tags counts sort=count # Most used tags
|
obsidian tags counts sort=count # Most used tags
|
||||||
obsidian tasks # Open tasks across vault
|
obsidian tasks | grep "\[ \]" # Incomplete tasks across vault
|
||||||
obsidian orphans # Notes needing integration
|
obsidian orphans # Notes needing integration
|
||||||
obsidian unresolved # Broken links to fix
|
obsidian unresolved # Broken links to fix
|
||||||
```
|
```
|
||||||
@@ -186,7 +194,7 @@ obsidian unresolved # Broken links to fix
|
|||||||
### Search and Extract for AI Processing
|
### Search and Extract for AI Processing
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian search query="meeting notes" format=json | jq '.[] | .path'
|
obsidian search query="meeting notes" format=json | jq '.[]'
|
||||||
obsidian read path="meetings/standup.md" | grep "Action item"
|
obsidian read path="meetings/standup.md" | grep "Action item"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -198,16 +206,29 @@ obsidian sync:history path="important.md" # Version history
|
|||||||
obsidian sync:restore path="important.md" version=3 # Rollback
|
obsidian sync:restore path="important.md" version=3 # Rollback
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Execute Obsidian Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Find a command ID, then execute it
|
||||||
|
obsidian commands | grep "graph"
|
||||||
|
obsidian command id="graph:open"
|
||||||
|
|
||||||
|
# Open settings, trigger a plugin action
|
||||||
|
obsidian command id="app:open-settings"
|
||||||
|
obsidian command id="dataview:dataview-force-refresh-views"
|
||||||
|
```
|
||||||
|
|
||||||
## Tips
|
## Tips
|
||||||
|
|
||||||
1. **Paths are vault-relative** — use `folder/note.md`, not absolute filesystem paths.
|
1. **Paths are vault-relative** — use `folder/note.md`, not absolute filesystem paths.
|
||||||
2. **`create` paths omit `.md`** — the extension is added automatically.
|
2. **`create` paths omit `.md`** — the extension is added automatically.
|
||||||
3. **`move` requires full target path** including `.md` extension.
|
3. **`move` requires full target path** including `.md` extension.
|
||||||
4. **Pipe-friendly** — plain text output works with `grep`, `awk`, `sed`, `jq`.
|
4. **Pipe-friendly** — plain text output works with `grep`, `awk`, `sed`, `jq`.
|
||||||
5. **JSON output** — use `format=json` on search and file commands for machine parsing.
|
5. **JSON output** — use `format=json` on `search` for a JSON array of file paths. The `files` command does not support JSON output.
|
||||||
6. **Stderr noise** — GPU/Electron warnings on headless are harmless; filter with `2>/dev/null`.
|
6. **Stderr noise** — GPU/Electron warnings on headless are harmless; filter with `2>/dev/null`.
|
||||||
7. **`daily:prepend`** inserts content after frontmatter, not at byte 0.
|
7. **`daily:prepend`** inserts content after frontmatter, not at byte 0.
|
||||||
8. **Use `eval`** to run arbitrary JavaScript against the Obsidian API (`app.*`).
|
8. **Use `eval`** to run arbitrary JavaScript against the Obsidian API (`app.*`).
|
||||||
|
9. **`template:insert`** inserts into the currently active file in the Obsidian UI — it does not accept a `path=` parameter. If no file is open, it returns `Error: No active editor. Open a file first.` To create a file from a template via CLI, use `obsidian create path="..." template="..."` instead.
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,14 @@ All parameters use `key=value` syntax. Quote values containing spaces: `content=
|
|||||||
10. [Plugins](#plugins)
|
10. [Plugins](#plugins)
|
||||||
11. [Sync](#sync)
|
11. [Sync](#sync)
|
||||||
12. [Themes](#themes)
|
12. [Themes](#themes)
|
||||||
13. [Developer](#developer)
|
13. [CSS Snippets](#css-snippets)
|
||||||
14. [Vault & System](#vault--system)
|
14. [Commands & Hotkeys](#commands--hotkeys)
|
||||||
|
15. [Obsidian Bases](#obsidian-bases)
|
||||||
|
16. [History](#history)
|
||||||
|
17. [Workspace & Tabs](#workspace--tabs)
|
||||||
|
18. [Diff](#diff)
|
||||||
|
19. [Developer](#developer)
|
||||||
|
20. [Vault & System](#vault--system)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -83,11 +89,26 @@ obsidian files # List all files in vault
|
|||||||
obsidian files ext=md # Filter by extension
|
obsidian files ext=md # Filter by extension
|
||||||
obsidian files folder="subfolder" # Files in specific folder
|
obsidian files folder="subfolder" # Files in specific folder
|
||||||
obsidian files total # Just the file count
|
obsidian files total # Just the file count
|
||||||
obsidian files format=json # JSON output
|
|
||||||
obsidian folders # List all folders
|
obsidian folders # List all folders
|
||||||
obsidian file path="folder/note.md" # File info (size, created, modified dates)
|
obsidian file path="folder/note.md" # File info (size, created, modified dates)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Random Notes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian random # Open a random note in Obsidian
|
||||||
|
obsidian random:read # Print content of a random note to stdout
|
||||||
|
```
|
||||||
|
|
||||||
|
### Renaming
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian rename path="folder/note.md" name="new-name"
|
||||||
|
```
|
||||||
|
|
||||||
|
- `name=` is the new filename only (no path, no `.md` extension).
|
||||||
|
- Use `move` when you also want to change the folder.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Daily Notes
|
## Daily Notes
|
||||||
@@ -99,6 +120,7 @@ obsidian daily # Open today's daily note in Obsidian
|
|||||||
obsidian daily:read # Print today's daily note content to stdout
|
obsidian daily:read # Print today's daily note content to stdout
|
||||||
obsidian daily:append content="text" # Append content to today's note
|
obsidian daily:append content="text" # Append content to today's note
|
||||||
obsidian daily:prepend content="text" # Prepend content (after frontmatter)
|
obsidian daily:prepend content="text" # Prepend content (after frontmatter)
|
||||||
|
obsidian daily:path # Print vault-relative path of today's note
|
||||||
```
|
```
|
||||||
|
|
||||||
**Notes:**
|
**Notes:**
|
||||||
@@ -116,8 +138,8 @@ Full-text search across the vault.
|
|||||||
obsidian search query="search text"
|
obsidian search query="search text"
|
||||||
obsidian search query="text" path="folder" # Scope to folder
|
obsidian search query="text" path="folder" # Scope to folder
|
||||||
obsidian search query="text" limit=10 # Limit results
|
obsidian search query="text" limit=10 # Limit results
|
||||||
obsidian search query="text" format=json # JSON output
|
obsidian search query="text" format=json # JSON output (array of file paths)
|
||||||
obsidian search query="text" matches # Include match context/snippets
|
obsidian search query="text" matches # Accepted but returns file paths only
|
||||||
obsidian search query="text" case # Case-sensitive search
|
obsidian search query="text" case # Case-sensitive search
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -125,10 +147,29 @@ obsidian search query="text" case # Case-sensitive search
|
|||||||
- `query=` — Search term (required)
|
- `query=` — Search term (required)
|
||||||
- `path=` — Restrict search to a folder
|
- `path=` — Restrict search to a folder
|
||||||
- `limit=` — Maximum number of results
|
- `limit=` — Maximum number of results
|
||||||
- `format=json` — Machine-readable JSON output
|
- `format=json` — Returns a JSON array of matching file paths: `["folder/note.md", ...]`
|
||||||
- `matches` — Show matching line context
|
- `matches` — Flag accepted by the CLI but does not return match context/snippets in v1.12
|
||||||
- `case` — Enable case-sensitive matching
|
- `case` — Enable case-sensitive matching
|
||||||
|
|
||||||
|
### Search with Context
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian search:context query="search text"
|
||||||
|
obsidian search:context query="text" path="folder" limit=10
|
||||||
|
obsidian search:context query="text" case
|
||||||
|
obsidian search:context query="text" format=json
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns matching lines with surrounding context (not just file paths). Useful when you need to see the actual content that matched rather than just file paths.
|
||||||
|
|
||||||
|
### Open Search View
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian search:open query="search text"
|
||||||
|
```
|
||||||
|
|
||||||
|
Opens the Obsidian search panel in the UI with the given query.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
@@ -196,13 +237,15 @@ Query and manage checkbox tasks across the vault.
|
|||||||
### Querying Tasks
|
### Querying Tasks
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian tasks # All incomplete tasks
|
obsidian tasks # All tasks (same as tasks all in v1.12)
|
||||||
obsidian tasks all # All tasks (complete + incomplete)
|
obsidian tasks all # All tasks (complete + incomplete)
|
||||||
obsidian tasks done # Only completed tasks
|
obsidian tasks done # Only completed tasks
|
||||||
obsidian tasks path="note.md" # Tasks in a specific file
|
obsidian tasks path="note.md" # Tasks in a specific file
|
||||||
obsidian tasks daily # Tasks in today's daily note
|
obsidian tasks daily # Tasks in today's daily note
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** In v1.12, `tasks` with no arguments returns all tasks (complete + incomplete), identical to `tasks all`. Filtering to incomplete-only is not currently supported without post-processing (e.g. pipe to `grep "\[ \]"`).
|
||||||
|
|
||||||
### Toggling Task Status
|
### Toggling Task Status
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -234,10 +277,13 @@ Manage Obsidian bookmarks (requires Bookmarks core plugin).
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian bookmarks # List all bookmarks
|
obsidian bookmarks # List all bookmarks
|
||||||
|
obsidian bookmark file="folder/note.md" # Bookmark a note
|
||||||
|
obsidian bookmark file="folder/note.md" subpath="#Heading" # Bookmark a heading
|
||||||
|
obsidian bookmark folder="projects" # Bookmark a folder
|
||||||
|
obsidian bookmark search="query text" title="My Search" # Bookmark a search
|
||||||
|
obsidian bookmark url="https://example.com" title="Link" # Bookmark a URL
|
||||||
```
|
```
|
||||||
|
|
||||||
Bookmarks commands let you view and manage bookmarked notes, searches, and groups. Use `obsidian bookmarks --help` for all available subcommands.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Templates
|
## Templates
|
||||||
@@ -248,14 +294,16 @@ Work with note templates (requires Templates or Templater plugin).
|
|||||||
obsidian templates # List available templates
|
obsidian templates # List available templates
|
||||||
obsidian template:read name="weekly-review" # Read template content
|
obsidian template:read name="weekly-review" # Read template content
|
||||||
obsidian template:read name="weekly-review" resolve title="My Note" # Render with variables
|
obsidian template:read name="weekly-review" resolve title="My Note" # Render with variables
|
||||||
obsidian template:insert name="weekly-review" # Insert template into active file
|
obsidian template:insert name="weekly-review" # Insert template into the active Obsidian UI file
|
||||||
```
|
```
|
||||||
|
|
||||||
**Parameters:**
|
**Parameters:**
|
||||||
- `name=` — Template name (without path prefix or extension)
|
- `name=` — Template name (without path prefix or extension)
|
||||||
- `resolve` — Process template variables
|
- `resolve` — Process template variables (`{{date}}`, `{{title}}`, etc.)
|
||||||
- Title and other variables can be passed as `key=value` for template rendering.
|
- Title and other variables can be passed as `key=value` for template rendering.
|
||||||
|
|
||||||
|
> **Note:** `template:insert` inserts into whichever file is currently active in the Obsidian UI — it does not accept a `path=` parameter. If no file is open, it returns `Error: No active editor. Open a file first.` To create a new file from a template, use `obsidian create path="..." template="..."` instead.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
@@ -263,15 +311,22 @@ obsidian template:insert name="weekly-review" # Insert template into a
|
|||||||
Manage community and core plugins.
|
Manage community and core plugins.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian plugins # List all installed plugins
|
obsidian plugins # List all plugins (core + community)
|
||||||
obsidian plugins:enabled # Only enabled plugins
|
obsidian plugins:enabled # Only enabled plugins
|
||||||
obsidian plugins versions # Plugins with version numbers
|
obsidian plugins versions # Plugins with version numbers (community only)
|
||||||
|
obsidian plugins:restrict # Show restricted mode status
|
||||||
|
obsidian plugins:restrict on # Enable restricted mode (disables community plugins)
|
||||||
|
obsidian plugins:restrict off # Disable restricted mode
|
||||||
|
obsidian plugin id="dataview" # Get info about a specific plugin
|
||||||
obsidian plugin:enable id="canvas" # Enable a plugin
|
obsidian plugin:enable id="canvas" # Enable a plugin
|
||||||
obsidian plugin:disable id="canvas" # Disable a plugin
|
obsidian plugin:disable id="canvas" # Disable a plugin
|
||||||
obsidian plugin:install id="dataview" # Install from community plugins
|
obsidian plugin:install id="dataview" # Install from community plugins
|
||||||
|
obsidian plugin:uninstall id="dataview" # Uninstall a community plugin
|
||||||
obsidian plugin:reload id="my-plugin" # Reload a plugin (useful for dev)
|
obsidian plugin:reload id="my-plugin" # Reload a plugin (useful for dev)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** `plugins versions` only shows version numbers for community plugins. Core (built-in) plugins share Obsidian's version and display blank version fields.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Sync
|
## Sync
|
||||||
@@ -287,6 +342,7 @@ obsidian sync:history path="note.md" # Version history for a file
|
|||||||
obsidian sync:read path="note.md" version=3 # Read a specific version
|
obsidian sync:read path="note.md" version=3 # Read a specific version
|
||||||
obsidian sync:restore path="note.md" version=3 # Restore a previous version
|
obsidian sync:restore path="note.md" version=3 # Restore a previous version
|
||||||
obsidian sync:deleted # List files deleted via sync
|
obsidian sync:deleted # List files deleted via sync
|
||||||
|
obsidian sync:open # Open the Sync history view in the UI
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -296,10 +352,117 @@ obsidian sync:deleted # List files deleted via sync
|
|||||||
Manage appearance themes.
|
Manage appearance themes.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian themes # List available/installed themes
|
obsidian themes # List installed themes
|
||||||
|
obsidian themes versions # List installed themes with version numbers
|
||||||
|
obsidian theme # Show the currently active theme
|
||||||
|
obsidian theme name="Minimal" # Get details about a specific theme
|
||||||
|
obsidian theme:set name="Minimal" # Switch to a theme
|
||||||
|
obsidian theme:set name="" # Switch back to default theme
|
||||||
|
obsidian theme:install name="Minimal" # Install a community theme
|
||||||
|
obsidian theme:install name="Minimal" enable # Install and activate immediately
|
||||||
|
obsidian theme:uninstall name="Minimal" # Uninstall a theme
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `obsidian themes --help` for additional subcommands related to theme management (install, switch, etc.).
|
---
|
||||||
|
|
||||||
|
## CSS Snippets
|
||||||
|
|
||||||
|
Manage custom CSS snippet files (snippets live in `.obsidian/snippets/`).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian snippets # List all installed CSS snippets
|
||||||
|
obsidian snippets:enabled # List only enabled snippets
|
||||||
|
obsidian snippet:enable name="my-style" # Enable a snippet
|
||||||
|
obsidian snippet:disable name="my-style" # Disable a snippet
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Commands & Hotkeys
|
||||||
|
|
||||||
|
Execute any Obsidian command by its ID, and inspect hotkey bindings.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian commands # List all available command IDs
|
||||||
|
obsidian command id="app:reload" # Execute a command by ID
|
||||||
|
obsidian command id="editor:toggle-bold" # Example: toggle bold in active editor
|
||||||
|
obsidian hotkeys # List all hotkeys (tab-separated: id \t keybinding)
|
||||||
|
obsidian hotkey id="app:open-settings" # Get hotkey for a specific command
|
||||||
|
obsidian hotkey id="app:open-settings" verbose # Show if custom or default
|
||||||
|
```
|
||||||
|
|
||||||
|
**Typical workflow — find and run a command:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian commands | grep "canvas" # Find canvas-related command IDs
|
||||||
|
obsidian command id="canvas:new-file" # Execute the matched command
|
||||||
|
```
|
||||||
|
|
||||||
|
**Getting plugin command IDs:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian commands | grep "dataview" # List all Dataview plugin commands
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Obsidian Bases
|
||||||
|
|
||||||
|
Obsidian Bases (v1.12+) is a built-in database feature. Base files (`.base`) store structured data and support multiple views.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian bases # List all .base files in vault
|
||||||
|
obsidian base:query file="tasks" format=json # Query default view of a base
|
||||||
|
obsidian base:query file="tasks" view="Kanban" # Query a specific view
|
||||||
|
obsidian base:query path="folder/tasks.base" format=csv # Query by path
|
||||||
|
obsidian base:views file="tasks" # List all views in a base file
|
||||||
|
obsidian base:create file="tasks" title="Buy milk" # Add an item to a base
|
||||||
|
```
|
||||||
|
|
||||||
|
**Supported output formats for `base:query`:** `json` (default), `csv`, `tsv`, `md`, `paths`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## History
|
||||||
|
|
||||||
|
File version history (built-in to Obsidian, separate from Sync). Requires the File Recovery core plugin.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian history:list # List all files that have history
|
||||||
|
obsidian history path="folder/note.md" # List versions of a specific file
|
||||||
|
obsidian history:read path="folder/note.md" # Read the latest saved version
|
||||||
|
obsidian history:read path="folder/note.md" version=3 # Read a specific version
|
||||||
|
obsidian history:restore path="folder/note.md" version=3 # Restore a version
|
||||||
|
obsidian history:open path="folder/note.md" # Open file recovery UI for a file
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note:** History is distinct from [Sync version history](#sync). History uses Obsidian's built-in File Recovery snapshots; Sync history uses Obsidian Sync cloud versions.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workspace & Tabs
|
||||||
|
|
||||||
|
Inspect and manage the Obsidian workspace layout and open tabs.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian workspace # Show the full workspace tree
|
||||||
|
obsidian tabs # List all open tabs (flat list)
|
||||||
|
obsidian tab:open file="folder/note.md" # Open a file in a new tab
|
||||||
|
obsidian tab:open view="graph" # Open a view type in a new tab
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Diff
|
||||||
|
|
||||||
|
Compare local and sync versions of a file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian diff path="folder/note.md" # List available versions (local + sync)
|
||||||
|
obsidian diff path="folder/note.md" from=1 to=2 # Diff two specific versions
|
||||||
|
obsidian diff path="folder/note.md" filter=local # Show only local versions
|
||||||
|
obsidian diff path="folder/note.md" filter=sync # Show only sync versions
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -310,10 +473,10 @@ Debugging and development tools.
|
|||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian dev:screenshot path="screenshot.png"
|
obsidian dev:screenshot path="folder/screenshot.png"
|
||||||
```
|
```
|
||||||
|
|
||||||
Takes a screenshot of the Obsidian window and saves it.
|
Takes a screenshot of the Obsidian window and saves it. **Path must be vault-relative** — absolute filesystem paths are silently ignored.
|
||||||
|
|
||||||
### JavaScript Evaluation
|
### JavaScript Evaluation
|
||||||
|
|
||||||
@@ -327,10 +490,46 @@ Executes arbitrary JavaScript in the Obsidian app context. Has access to the ful
|
|||||||
### Console & Errors
|
### Console & Errors
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian dev:console limit=20 # Recent console output
|
obsidian dev:debug on # Start capturing console output (required before dev:console)
|
||||||
|
obsidian dev:debug off # Stop capturing console output
|
||||||
|
obsidian dev:console limit=20 # Recent console output (requires dev:debug on first)
|
||||||
obsidian dev:errors # Recent error messages
|
obsidian dev:errors # Recent error messages
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** `dev:console` will return an error unless `dev:debug on` has been run first in the current session.
|
||||||
|
|
||||||
|
### DOM Inspection
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian dev:dom selector=".view-content" # Get outerHTML of first match
|
||||||
|
obsidian dev:dom selector=".view-content" all # Get all matches
|
||||||
|
obsidian dev:dom selector=".view-content" text # Get text content
|
||||||
|
obsidian dev:dom selector=".view-content" total # Count matching elements
|
||||||
|
obsidian dev:dom selector=".view-content" attr=class # Get an attribute value
|
||||||
|
obsidian dev:dom selector=".view-content" css=color # Get a CSS property value
|
||||||
|
```
|
||||||
|
|
||||||
|
### CSS Inspection
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian dev:css selector=".view-content" # Inspect CSS with source locations
|
||||||
|
obsidian dev:css selector=".view-content" prop=color # Filter by CSS property name
|
||||||
|
```
|
||||||
|
|
||||||
|
### Chrome DevTools Protocol
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian devtools # Toggle Electron DevTools panel
|
||||||
|
obsidian dev:cdp method="Runtime.evaluate" params='{"expression":"1+1"}' # Run a CDP command
|
||||||
|
```
|
||||||
|
|
||||||
|
### Mobile Emulation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian dev:mobile on # Enable mobile emulation
|
||||||
|
obsidian dev:mobile off # Disable mobile emulation
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Vault & System
|
## Vault & System
|
||||||
@@ -350,13 +549,31 @@ obsidian outline path="note.md" # Heading structure of a note
|
|||||||
obsidian wordcount path="note.md" # Word and character count
|
obsidian wordcount path="note.md" # Word and character count
|
||||||
obsidian recents # Recently opened files
|
obsidian recents # Recently opened files
|
||||||
obsidian reload # Reload the vault (re-index)
|
obsidian reload # Reload the vault (re-index)
|
||||||
|
obsidian restart # Restart the Obsidian app
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Output Formatting & Piping
|
## Output Formatting & Piping
|
||||||
|
|
||||||
The CLI outputs plain text by default, ideal for piping into Unix tools:
|
The CLI outputs plain text by default, ideal for piping into Unix tools.
|
||||||
|
|
||||||
|
### Supported `format=` values
|
||||||
|
|
||||||
|
| Format | Description | Best for |
|
||||||
|
|---|---|---|
|
||||||
|
| `text` | Plain text (default) | Piping to grep/awk/sed |
|
||||||
|
| `json` | JSON array or object | Processing with jq, AI agents |
|
||||||
|
| `csv` | Comma-separated values | Spreadsheet import |
|
||||||
|
| `tsv` | Tab-separated values | Shell parsing with cut/awk |
|
||||||
|
| `yaml` | YAML output | Config-style processing |
|
||||||
|
| `md` | Markdown table | Embedding results in notes |
|
||||||
|
| `paths` | One path per line | Batch file operations |
|
||||||
|
| `tree` | Tree view | Visual hierarchy |
|
||||||
|
|
||||||
|
Not all formats are supported by every command. Use `text` or `json` when in doubt.
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Count notes in a folder
|
# Count notes in a folder
|
||||||
@@ -369,9 +586,14 @@ obsidian tag name="urgent" | while read -r note; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Export search results as JSON and process with jq
|
# Export search results as JSON and process with jq
|
||||||
obsidian search query="meeting" format=json | jq '.[].path'
|
# format=json returns an array of file path strings: ["folder/note.md", ...]
|
||||||
|
obsidian search query="meeting" format=json | jq '.[]'
|
||||||
|
|
||||||
# Filter console errors
|
# Query a base as CSV
|
||||||
|
obsidian base:query file="tasks" format=csv
|
||||||
|
|
||||||
|
# Filter console errors (requires dev:debug on first)
|
||||||
|
obsidian dev:debug on
|
||||||
obsidian dev:console limit=50 | grep -i error
|
obsidian dev:console limit=50 | grep -i error
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -55,25 +55,31 @@ If omitted, the CLI targets the most recently active vault.
|
|||||||
|
|
||||||
## Command Overview
|
## Command Overview
|
||||||
|
|
||||||
The CLI provides **100+ commands** across these groups:
|
The CLI provides **130+ commands** across these groups:
|
||||||
|
|
||||||
| Group | Key Commands | Purpose |
|
| Group | Key Commands | Purpose |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| **files** | `read`, `create`, `append`, `prepend`, `move`, `delete`, `files`, `folders`, `file` | Note CRUD and file discovery |
|
| **files** | `read`, `create`, `append`, `prepend`, `move`, `rename`, `delete`, `files`, `folders`, `file`, `random` | Note CRUD and file discovery |
|
||||||
| **daily** | `daily`, `daily:read`, `daily:append`, `daily:prepend` | Daily note operations |
|
| **daily** | `daily`, `daily:read`, `daily:append`, `daily:prepend`, `daily:path` | Daily note operations |
|
||||||
| **search** | `search` | Full-text vault search with scoping and JSON output |
|
| **search** | `search`, `search:context` | Full-text search; `search:context` returns matching lines |
|
||||||
| **properties** | `properties`, `property:read`, `property:set`, `property:remove`, `aliases` | Frontmatter/metadata management |
|
| **properties** | `properties`, `property:read`, `property:set`, `property:remove`, `aliases` | Frontmatter/metadata management |
|
||||||
| **tags** | `tags`, `tag` | Tag listing, counts, and filtering |
|
| **tags** | `tags`, `tag` | Tag listing, counts, and filtering |
|
||||||
| **tasks** | `tasks`, `task` | Task querying, filtering, and toggling |
|
| **tasks** | `tasks`, `task` | Task querying, filtering, and toggling |
|
||||||
| **links** | `backlinks`, `links`, `unresolved`, `orphans`, `deadends` | Graph and link analysis |
|
| **links** | `backlinks`, `links`, `unresolved`, `orphans`, `deadends` | Graph and link analysis |
|
||||||
| **bookmarks** | `bookmarks` | Bookmark management |
|
| **bookmarks** | `bookmarks`, `bookmark` | List and add bookmarks |
|
||||||
| **templates** | `templates`, `template:read`, `template:insert` | Template listing, rendering, insertion |
|
| **templates** | `templates`, `template:read`, `template:insert` | Template listing, rendering, insertion |
|
||||||
| **plugins** | `plugins`, `plugin:enable`, `plugin:disable`, `plugin:install`, `plugin:reload` | Plugin management |
|
| **plugins** | `plugins`, `plugin`, `plugin:enable`, `plugin:disable`, `plugin:install`, `plugin:uninstall`, `plugins:restrict` | Plugin management |
|
||||||
| **sync** | `sync`, `sync:status`, `sync:history`, `sync:read`, `sync:restore`, `sync:deleted` | Obsidian Sync operations |
|
| **sync** | `sync`, `sync:status`, `sync:history`, `sync:read`, `sync:restore`, `sync:deleted` | Obsidian Sync operations |
|
||||||
| **themes** | `themes` | Theme management |
|
| **themes** | `themes`, `theme`, `theme:set`, `theme:install`, `theme:uninstall` | Theme management |
|
||||||
| **dev** | `dev:screenshot`, `eval`, `dev:console`, `dev:errors` | Developer/debugging tools |
|
| **snippets** | `snippets`, `snippets:enabled`, `snippet:enable`, `snippet:disable` | CSS snippet management |
|
||||||
| **vault** | `vault`, `vaults`, `version` | Vault info and metadata |
|
| **commands** | `commands`, `command`, `hotkeys`, `hotkey` | Execute Obsidian commands by ID; inspect hotkeys |
|
||||||
| **other** | `outline`, `wordcount`, `recents`, `reload` | Utility commands |
|
| **bases** | `bases`, `base:query`, `base:views`, `base:create` | Obsidian Bases (v1.12+ database feature) |
|
||||||
|
| **history** | `history`, `history:list`, `history:read`, `history:restore` | File version recovery (File Recovery plugin) |
|
||||||
|
| **workspace** | `workspace`, `tabs`, `tab:open` | Workspace layout and tab management |
|
||||||
|
| **diff** | `diff` | Compare local vs sync file versions |
|
||||||
|
| **dev** | `eval`, `dev:screenshot`, `dev:debug`, `dev:console`, `dev:errors`, `dev:css`, `dev:dom`, `devtools` | Developer/debugging tools |
|
||||||
|
| **vault** | `vault`, `vaults`, `version`, `reload`, `restart` | Vault info and app control |
|
||||||
|
| **other** | `outline`, `wordcount`, `recents` | Utility commands |
|
||||||
|
|
||||||
## Quick Reference — Most Common Commands
|
## Quick Reference — Most Common Commands
|
||||||
|
|
||||||
@@ -104,8 +110,8 @@ obsidian daily:prepend content="## Morning Notes"
|
|||||||
```bash
|
```bash
|
||||||
obsidian search query="project alpha"
|
obsidian search query="project alpha"
|
||||||
obsidian search query="TODO" path="projects" limit=10
|
obsidian search query="TODO" path="projects" limit=10
|
||||||
obsidian search query="meeting" format=json
|
obsidian search query="meeting" format=json # Returns JSON array of file paths
|
||||||
obsidian search query="urgent" matches case
|
obsidian search query="urgent" case
|
||||||
```
|
```
|
||||||
|
|
||||||
### Properties & Tags
|
### Properties & Tags
|
||||||
@@ -122,18 +128,20 @@ obsidian tag name="project/alpha"
|
|||||||
### Tasks
|
### Tasks
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian tasks # All incomplete tasks
|
obsidian tasks # All tasks (done + todo) — same as tasks all in v1.12
|
||||||
obsidian tasks all # All tasks (done + todo)
|
obsidian tasks all # All tasks (done + todo)
|
||||||
obsidian tasks done # Completed only
|
obsidian tasks done # Completed only
|
||||||
obsidian tasks daily # Tasks in today's daily note
|
obsidian tasks daily # Tasks in today's daily note
|
||||||
obsidian task path="note.md" line=12 toggle
|
obsidian task path="note.md" line=12 toggle
|
||||||
|
obsidian tasks | grep "\[ \]" # Workaround: filter to incomplete only
|
||||||
```
|
```
|
||||||
|
|
||||||
### Developer & Automation
|
### Developer & Automation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian eval code="app.vault.getFiles().length"
|
obsidian eval code="app.vault.getFiles().length"
|
||||||
obsidian dev:screenshot path="screenshot.png"
|
obsidian dev:screenshot path="folder/screenshot.png" # Path must be vault-relative
|
||||||
|
obsidian dev:debug on # Required before dev:console
|
||||||
obsidian dev:console limit=20
|
obsidian dev:console limit=20
|
||||||
obsidian dev:errors
|
obsidian dev:errors
|
||||||
```
|
```
|
||||||
@@ -178,7 +186,7 @@ obsidian daily:append content="- Started [[projects/new-feature|New Feature]]"
|
|||||||
```bash
|
```bash
|
||||||
obsidian files total # Total file count
|
obsidian files total # Total file count
|
||||||
obsidian tags counts sort=count # Most used tags
|
obsidian tags counts sort=count # Most used tags
|
||||||
obsidian tasks # Open tasks across vault
|
obsidian tasks | grep "\[ \]" # Incomplete tasks across vault
|
||||||
obsidian orphans # Notes needing integration
|
obsidian orphans # Notes needing integration
|
||||||
obsidian unresolved # Broken links to fix
|
obsidian unresolved # Broken links to fix
|
||||||
```
|
```
|
||||||
@@ -186,7 +194,7 @@ obsidian unresolved # Broken links to fix
|
|||||||
### Search and Extract for AI Processing
|
### Search and Extract for AI Processing
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian search query="meeting notes" format=json | jq '.[] | .path'
|
obsidian search query="meeting notes" format=json | jq '.[]'
|
||||||
obsidian read path="meetings/standup.md" | grep "Action item"
|
obsidian read path="meetings/standup.md" | grep "Action item"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -198,16 +206,29 @@ obsidian sync:history path="important.md" # Version history
|
|||||||
obsidian sync:restore path="important.md" version=3 # Rollback
|
obsidian sync:restore path="important.md" version=3 # Rollback
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Execute Obsidian Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Find a command ID, then execute it
|
||||||
|
obsidian commands | grep "graph"
|
||||||
|
obsidian command id="graph:open"
|
||||||
|
|
||||||
|
# Open settings, trigger a plugin action
|
||||||
|
obsidian command id="app:open-settings"
|
||||||
|
obsidian command id="dataview:dataview-force-refresh-views"
|
||||||
|
```
|
||||||
|
|
||||||
## Tips
|
## Tips
|
||||||
|
|
||||||
1. **Paths are vault-relative** — use `folder/note.md`, not absolute filesystem paths.
|
1. **Paths are vault-relative** — use `folder/note.md`, not absolute filesystem paths.
|
||||||
2. **`create` paths omit `.md`** — the extension is added automatically.
|
2. **`create` paths omit `.md`** — the extension is added automatically.
|
||||||
3. **`move` requires full target path** including `.md` extension.
|
3. **`move` requires full target path** including `.md` extension.
|
||||||
4. **Pipe-friendly** — plain text output works with `grep`, `awk`, `sed`, `jq`.
|
4. **Pipe-friendly** — plain text output works with `grep`, `awk`, `sed`, `jq`.
|
||||||
5. **JSON output** — use `format=json` on search and file commands for machine parsing.
|
5. **JSON output** — use `format=json` on `search` for a JSON array of file paths. The `files` command does not support JSON output.
|
||||||
6. **Stderr noise** — GPU/Electron warnings on headless are harmless; filter with `2>/dev/null`.
|
6. **Stderr noise** — GPU/Electron warnings on headless are harmless; filter with `2>/dev/null`.
|
||||||
7. **`daily:prepend`** inserts content after frontmatter, not at byte 0.
|
7. **`daily:prepend`** inserts content after frontmatter, not at byte 0.
|
||||||
8. **Use `eval`** to run arbitrary JavaScript against the Obsidian API (`app.*`).
|
8. **Use `eval`** to run arbitrary JavaScript against the Obsidian API (`app.*`).
|
||||||
|
9. **`template:insert`** inserts into the currently active file in the Obsidian UI — it does not accept a `path=` parameter. If no file is open, it returns `Error: No active editor. Open a file first.` To create a file from a template via CLI, use `obsidian create path="..." template="..."` instead.
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,14 @@ All parameters use `key=value` syntax. Quote values containing spaces: `content=
|
|||||||
10. [Plugins](#plugins)
|
10. [Plugins](#plugins)
|
||||||
11. [Sync](#sync)
|
11. [Sync](#sync)
|
||||||
12. [Themes](#themes)
|
12. [Themes](#themes)
|
||||||
13. [Developer](#developer)
|
13. [CSS Snippets](#css-snippets)
|
||||||
14. [Vault & System](#vault--system)
|
14. [Commands & Hotkeys](#commands--hotkeys)
|
||||||
|
15. [Obsidian Bases](#obsidian-bases)
|
||||||
|
16. [History](#history)
|
||||||
|
17. [Workspace & Tabs](#workspace--tabs)
|
||||||
|
18. [Diff](#diff)
|
||||||
|
19. [Developer](#developer)
|
||||||
|
20. [Vault & System](#vault--system)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -83,11 +89,26 @@ obsidian files # List all files in vault
|
|||||||
obsidian files ext=md # Filter by extension
|
obsidian files ext=md # Filter by extension
|
||||||
obsidian files folder="subfolder" # Files in specific folder
|
obsidian files folder="subfolder" # Files in specific folder
|
||||||
obsidian files total # Just the file count
|
obsidian files total # Just the file count
|
||||||
obsidian files format=json # JSON output
|
|
||||||
obsidian folders # List all folders
|
obsidian folders # List all folders
|
||||||
obsidian file path="folder/note.md" # File info (size, created, modified dates)
|
obsidian file path="folder/note.md" # File info (size, created, modified dates)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Random Notes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian random # Open a random note in Obsidian
|
||||||
|
obsidian random:read # Print content of a random note to stdout
|
||||||
|
```
|
||||||
|
|
||||||
|
### Renaming
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian rename path="folder/note.md" name="new-name"
|
||||||
|
```
|
||||||
|
|
||||||
|
- `name=` is the new filename only (no path, no `.md` extension).
|
||||||
|
- Use `move` when you also want to change the folder.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Daily Notes
|
## Daily Notes
|
||||||
@@ -99,6 +120,7 @@ obsidian daily # Open today's daily note in Obsidian
|
|||||||
obsidian daily:read # Print today's daily note content to stdout
|
obsidian daily:read # Print today's daily note content to stdout
|
||||||
obsidian daily:append content="text" # Append content to today's note
|
obsidian daily:append content="text" # Append content to today's note
|
||||||
obsidian daily:prepend content="text" # Prepend content (after frontmatter)
|
obsidian daily:prepend content="text" # Prepend content (after frontmatter)
|
||||||
|
obsidian daily:path # Print vault-relative path of today's note
|
||||||
```
|
```
|
||||||
|
|
||||||
**Notes:**
|
**Notes:**
|
||||||
@@ -116,8 +138,8 @@ Full-text search across the vault.
|
|||||||
obsidian search query="search text"
|
obsidian search query="search text"
|
||||||
obsidian search query="text" path="folder" # Scope to folder
|
obsidian search query="text" path="folder" # Scope to folder
|
||||||
obsidian search query="text" limit=10 # Limit results
|
obsidian search query="text" limit=10 # Limit results
|
||||||
obsidian search query="text" format=json # JSON output
|
obsidian search query="text" format=json # JSON output (array of file paths)
|
||||||
obsidian search query="text" matches # Include match context/snippets
|
obsidian search query="text" matches # Accepted but returns file paths only
|
||||||
obsidian search query="text" case # Case-sensitive search
|
obsidian search query="text" case # Case-sensitive search
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -125,10 +147,29 @@ obsidian search query="text" case # Case-sensitive search
|
|||||||
- `query=` — Search term (required)
|
- `query=` — Search term (required)
|
||||||
- `path=` — Restrict search to a folder
|
- `path=` — Restrict search to a folder
|
||||||
- `limit=` — Maximum number of results
|
- `limit=` — Maximum number of results
|
||||||
- `format=json` — Machine-readable JSON output
|
- `format=json` — Returns a JSON array of matching file paths: `["folder/note.md", ...]`
|
||||||
- `matches` — Show matching line context
|
- `matches` — Flag accepted by the CLI but does not return match context/snippets in v1.12
|
||||||
- `case` — Enable case-sensitive matching
|
- `case` — Enable case-sensitive matching
|
||||||
|
|
||||||
|
### Search with Context
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian search:context query="search text"
|
||||||
|
obsidian search:context query="text" path="folder" limit=10
|
||||||
|
obsidian search:context query="text" case
|
||||||
|
obsidian search:context query="text" format=json
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns matching lines with surrounding context (not just file paths). Useful when you need to see the actual content that matched rather than just file paths.
|
||||||
|
|
||||||
|
### Open Search View
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian search:open query="search text"
|
||||||
|
```
|
||||||
|
|
||||||
|
Opens the Obsidian search panel in the UI with the given query.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
@@ -196,13 +237,15 @@ Query and manage checkbox tasks across the vault.
|
|||||||
### Querying Tasks
|
### Querying Tasks
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian tasks # All incomplete tasks
|
obsidian tasks # All tasks (same as tasks all in v1.12)
|
||||||
obsidian tasks all # All tasks (complete + incomplete)
|
obsidian tasks all # All tasks (complete + incomplete)
|
||||||
obsidian tasks done # Only completed tasks
|
obsidian tasks done # Only completed tasks
|
||||||
obsidian tasks path="note.md" # Tasks in a specific file
|
obsidian tasks path="note.md" # Tasks in a specific file
|
||||||
obsidian tasks daily # Tasks in today's daily note
|
obsidian tasks daily # Tasks in today's daily note
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** In v1.12, `tasks` with no arguments returns all tasks (complete + incomplete), identical to `tasks all`. Filtering to incomplete-only is not currently supported without post-processing (e.g. pipe to `grep "\[ \]"`).
|
||||||
|
|
||||||
### Toggling Task Status
|
### Toggling Task Status
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -234,10 +277,13 @@ Manage Obsidian bookmarks (requires Bookmarks core plugin).
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian bookmarks # List all bookmarks
|
obsidian bookmarks # List all bookmarks
|
||||||
|
obsidian bookmark file="folder/note.md" # Bookmark a note
|
||||||
|
obsidian bookmark file="folder/note.md" subpath="#Heading" # Bookmark a heading
|
||||||
|
obsidian bookmark folder="projects" # Bookmark a folder
|
||||||
|
obsidian bookmark search="query text" title="My Search" # Bookmark a search
|
||||||
|
obsidian bookmark url="https://example.com" title="Link" # Bookmark a URL
|
||||||
```
|
```
|
||||||
|
|
||||||
Bookmarks commands let you view and manage bookmarked notes, searches, and groups. Use `obsidian bookmarks --help` for all available subcommands.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Templates
|
## Templates
|
||||||
@@ -248,14 +294,16 @@ Work with note templates (requires Templates or Templater plugin).
|
|||||||
obsidian templates # List available templates
|
obsidian templates # List available templates
|
||||||
obsidian template:read name="weekly-review" # Read template content
|
obsidian template:read name="weekly-review" # Read template content
|
||||||
obsidian template:read name="weekly-review" resolve title="My Note" # Render with variables
|
obsidian template:read name="weekly-review" resolve title="My Note" # Render with variables
|
||||||
obsidian template:insert name="weekly-review" # Insert template into active file
|
obsidian template:insert name="weekly-review" # Insert template into the active Obsidian UI file
|
||||||
```
|
```
|
||||||
|
|
||||||
**Parameters:**
|
**Parameters:**
|
||||||
- `name=` — Template name (without path prefix or extension)
|
- `name=` — Template name (without path prefix or extension)
|
||||||
- `resolve` — Process template variables
|
- `resolve` — Process template variables (`{{date}}`, `{{title}}`, etc.)
|
||||||
- Title and other variables can be passed as `key=value` for template rendering.
|
- Title and other variables can be passed as `key=value` for template rendering.
|
||||||
|
|
||||||
|
> **Note:** `template:insert` inserts into whichever file is currently active in the Obsidian UI — it does not accept a `path=` parameter. If no file is open, it returns `Error: No active editor. Open a file first.` To create a new file from a template, use `obsidian create path="..." template="..."` instead.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
@@ -263,15 +311,22 @@ obsidian template:insert name="weekly-review" # Insert template into a
|
|||||||
Manage community and core plugins.
|
Manage community and core plugins.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian plugins # List all installed plugins
|
obsidian plugins # List all plugins (core + community)
|
||||||
obsidian plugins:enabled # Only enabled plugins
|
obsidian plugins:enabled # Only enabled plugins
|
||||||
obsidian plugins versions # Plugins with version numbers
|
obsidian plugins versions # Plugins with version numbers (community only)
|
||||||
|
obsidian plugins:restrict # Show restricted mode status
|
||||||
|
obsidian plugins:restrict on # Enable restricted mode (disables community plugins)
|
||||||
|
obsidian plugins:restrict off # Disable restricted mode
|
||||||
|
obsidian plugin id="dataview" # Get info about a specific plugin
|
||||||
obsidian plugin:enable id="canvas" # Enable a plugin
|
obsidian plugin:enable id="canvas" # Enable a plugin
|
||||||
obsidian plugin:disable id="canvas" # Disable a plugin
|
obsidian plugin:disable id="canvas" # Disable a plugin
|
||||||
obsidian plugin:install id="dataview" # Install from community plugins
|
obsidian plugin:install id="dataview" # Install from community plugins
|
||||||
|
obsidian plugin:uninstall id="dataview" # Uninstall a community plugin
|
||||||
obsidian plugin:reload id="my-plugin" # Reload a plugin (useful for dev)
|
obsidian plugin:reload id="my-plugin" # Reload a plugin (useful for dev)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** `plugins versions` only shows version numbers for community plugins. Core (built-in) plugins share Obsidian's version and display blank version fields.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Sync
|
## Sync
|
||||||
@@ -287,6 +342,7 @@ obsidian sync:history path="note.md" # Version history for a file
|
|||||||
obsidian sync:read path="note.md" version=3 # Read a specific version
|
obsidian sync:read path="note.md" version=3 # Read a specific version
|
||||||
obsidian sync:restore path="note.md" version=3 # Restore a previous version
|
obsidian sync:restore path="note.md" version=3 # Restore a previous version
|
||||||
obsidian sync:deleted # List files deleted via sync
|
obsidian sync:deleted # List files deleted via sync
|
||||||
|
obsidian sync:open # Open the Sync history view in the UI
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -296,10 +352,117 @@ obsidian sync:deleted # List files deleted via sync
|
|||||||
Manage appearance themes.
|
Manage appearance themes.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian themes # List available/installed themes
|
obsidian themes # List installed themes
|
||||||
|
obsidian themes versions # List installed themes with version numbers
|
||||||
|
obsidian theme # Show the currently active theme
|
||||||
|
obsidian theme name="Minimal" # Get details about a specific theme
|
||||||
|
obsidian theme:set name="Minimal" # Switch to a theme
|
||||||
|
obsidian theme:set name="" # Switch back to default theme
|
||||||
|
obsidian theme:install name="Minimal" # Install a community theme
|
||||||
|
obsidian theme:install name="Minimal" enable # Install and activate immediately
|
||||||
|
obsidian theme:uninstall name="Minimal" # Uninstall a theme
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `obsidian themes --help` for additional subcommands related to theme management (install, switch, etc.).
|
---
|
||||||
|
|
||||||
|
## CSS Snippets
|
||||||
|
|
||||||
|
Manage custom CSS snippet files (snippets live in `.obsidian/snippets/`).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian snippets # List all installed CSS snippets
|
||||||
|
obsidian snippets:enabled # List only enabled snippets
|
||||||
|
obsidian snippet:enable name="my-style" # Enable a snippet
|
||||||
|
obsidian snippet:disable name="my-style" # Disable a snippet
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Commands & Hotkeys
|
||||||
|
|
||||||
|
Execute any Obsidian command by its ID, and inspect hotkey bindings.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian commands # List all available command IDs
|
||||||
|
obsidian command id="app:reload" # Execute a command by ID
|
||||||
|
obsidian command id="editor:toggle-bold" # Example: toggle bold in active editor
|
||||||
|
obsidian hotkeys # List all hotkeys (tab-separated: id \t keybinding)
|
||||||
|
obsidian hotkey id="app:open-settings" # Get hotkey for a specific command
|
||||||
|
obsidian hotkey id="app:open-settings" verbose # Show if custom or default
|
||||||
|
```
|
||||||
|
|
||||||
|
**Typical workflow — find and run a command:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian commands | grep "canvas" # Find canvas-related command IDs
|
||||||
|
obsidian command id="canvas:new-file" # Execute the matched command
|
||||||
|
```
|
||||||
|
|
||||||
|
**Getting plugin command IDs:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian commands | grep "dataview" # List all Dataview plugin commands
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Obsidian Bases
|
||||||
|
|
||||||
|
Obsidian Bases (v1.12+) is a built-in database feature. Base files (`.base`) store structured data and support multiple views.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian bases # List all .base files in vault
|
||||||
|
obsidian base:query file="tasks" format=json # Query default view of a base
|
||||||
|
obsidian base:query file="tasks" view="Kanban" # Query a specific view
|
||||||
|
obsidian base:query path="folder/tasks.base" format=csv # Query by path
|
||||||
|
obsidian base:views file="tasks" # List all views in a base file
|
||||||
|
obsidian base:create file="tasks" title="Buy milk" # Add an item to a base
|
||||||
|
```
|
||||||
|
|
||||||
|
**Supported output formats for `base:query`:** `json` (default), `csv`, `tsv`, `md`, `paths`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## History
|
||||||
|
|
||||||
|
File version history (built-in to Obsidian, separate from Sync). Requires the File Recovery core plugin.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian history:list # List all files that have history
|
||||||
|
obsidian history path="folder/note.md" # List versions of a specific file
|
||||||
|
obsidian history:read path="folder/note.md" # Read the latest saved version
|
||||||
|
obsidian history:read path="folder/note.md" version=3 # Read a specific version
|
||||||
|
obsidian history:restore path="folder/note.md" version=3 # Restore a version
|
||||||
|
obsidian history:open path="folder/note.md" # Open file recovery UI for a file
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note:** History is distinct from [Sync version history](#sync). History uses Obsidian's built-in File Recovery snapshots; Sync history uses Obsidian Sync cloud versions.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workspace & Tabs
|
||||||
|
|
||||||
|
Inspect and manage the Obsidian workspace layout and open tabs.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian workspace # Show the full workspace tree
|
||||||
|
obsidian tabs # List all open tabs (flat list)
|
||||||
|
obsidian tab:open file="folder/note.md" # Open a file in a new tab
|
||||||
|
obsidian tab:open view="graph" # Open a view type in a new tab
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Diff
|
||||||
|
|
||||||
|
Compare local and sync versions of a file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian diff path="folder/note.md" # List available versions (local + sync)
|
||||||
|
obsidian diff path="folder/note.md" from=1 to=2 # Diff two specific versions
|
||||||
|
obsidian diff path="folder/note.md" filter=local # Show only local versions
|
||||||
|
obsidian diff path="folder/note.md" filter=sync # Show only sync versions
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -310,10 +473,10 @@ Debugging and development tools.
|
|||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian dev:screenshot path="screenshot.png"
|
obsidian dev:screenshot path="folder/screenshot.png"
|
||||||
```
|
```
|
||||||
|
|
||||||
Takes a screenshot of the Obsidian window and saves it.
|
Takes a screenshot of the Obsidian window and saves it. **Path must be vault-relative** — absolute filesystem paths are silently ignored.
|
||||||
|
|
||||||
### JavaScript Evaluation
|
### JavaScript Evaluation
|
||||||
|
|
||||||
@@ -327,10 +490,46 @@ Executes arbitrary JavaScript in the Obsidian app context. Has access to the ful
|
|||||||
### Console & Errors
|
### Console & Errors
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
obsidian dev:console limit=20 # Recent console output
|
obsidian dev:debug on # Start capturing console output (required before dev:console)
|
||||||
|
obsidian dev:debug off # Stop capturing console output
|
||||||
|
obsidian dev:console limit=20 # Recent console output (requires dev:debug on first)
|
||||||
obsidian dev:errors # Recent error messages
|
obsidian dev:errors # Recent error messages
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** `dev:console` will return an error unless `dev:debug on` has been run first in the current session.
|
||||||
|
|
||||||
|
### DOM Inspection
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian dev:dom selector=".view-content" # Get outerHTML of first match
|
||||||
|
obsidian dev:dom selector=".view-content" all # Get all matches
|
||||||
|
obsidian dev:dom selector=".view-content" text # Get text content
|
||||||
|
obsidian dev:dom selector=".view-content" total # Count matching elements
|
||||||
|
obsidian dev:dom selector=".view-content" attr=class # Get an attribute value
|
||||||
|
obsidian dev:dom selector=".view-content" css=color # Get a CSS property value
|
||||||
|
```
|
||||||
|
|
||||||
|
### CSS Inspection
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian dev:css selector=".view-content" # Inspect CSS with source locations
|
||||||
|
obsidian dev:css selector=".view-content" prop=color # Filter by CSS property name
|
||||||
|
```
|
||||||
|
|
||||||
|
### Chrome DevTools Protocol
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian devtools # Toggle Electron DevTools panel
|
||||||
|
obsidian dev:cdp method="Runtime.evaluate" params='{"expression":"1+1"}' # Run a CDP command
|
||||||
|
```
|
||||||
|
|
||||||
|
### Mobile Emulation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
obsidian dev:mobile on # Enable mobile emulation
|
||||||
|
obsidian dev:mobile off # Disable mobile emulation
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Vault & System
|
## Vault & System
|
||||||
@@ -350,13 +549,31 @@ obsidian outline path="note.md" # Heading structure of a note
|
|||||||
obsidian wordcount path="note.md" # Word and character count
|
obsidian wordcount path="note.md" # Word and character count
|
||||||
obsidian recents # Recently opened files
|
obsidian recents # Recently opened files
|
||||||
obsidian reload # Reload the vault (re-index)
|
obsidian reload # Reload the vault (re-index)
|
||||||
|
obsidian restart # Restart the Obsidian app
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Output Formatting & Piping
|
## Output Formatting & Piping
|
||||||
|
|
||||||
The CLI outputs plain text by default, ideal for piping into Unix tools:
|
The CLI outputs plain text by default, ideal for piping into Unix tools.
|
||||||
|
|
||||||
|
### Supported `format=` values
|
||||||
|
|
||||||
|
| Format | Description | Best for |
|
||||||
|
|---|---|---|
|
||||||
|
| `text` | Plain text (default) | Piping to grep/awk/sed |
|
||||||
|
| `json` | JSON array or object | Processing with jq, AI agents |
|
||||||
|
| `csv` | Comma-separated values | Spreadsheet import |
|
||||||
|
| `tsv` | Tab-separated values | Shell parsing with cut/awk |
|
||||||
|
| `yaml` | YAML output | Config-style processing |
|
||||||
|
| `md` | Markdown table | Embedding results in notes |
|
||||||
|
| `paths` | One path per line | Batch file operations |
|
||||||
|
| `tree` | Tree view | Visual hierarchy |
|
||||||
|
|
||||||
|
Not all formats are supported by every command. Use `text` or `json` when in doubt.
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Count notes in a folder
|
# Count notes in a folder
|
||||||
@@ -369,9 +586,14 @@ obsidian tag name="urgent" | while read -r note; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Export search results as JSON and process with jq
|
# Export search results as JSON and process with jq
|
||||||
obsidian search query="meeting" format=json | jq '.[].path'
|
# format=json returns an array of file path strings: ["folder/note.md", ...]
|
||||||
|
obsidian search query="meeting" format=json | jq '.[]'
|
||||||
|
|
||||||
# Filter console errors
|
# Query a base as CSV
|
||||||
|
obsidian base:query file="tasks" format=csv
|
||||||
|
|
||||||
|
# Filter console errors (requires dev:debug on first)
|
||||||
|
obsidian dev:debug on
|
||||||
obsidian dev:console limit=50 | grep -i error
|
obsidian dev:console limit=50 | grep -i error
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user