# Obsidian CLI Command Reference

Requires Obsidian v1.12.4+ with CLI enabled (Settings -> General -> Command line interface).

## Command Structure

```
obsidian [command] [subcommand] [options] [--flags]
```

## Global Flags

| Flag | Description |
|---|---|
| `--json` | Output as JSON |
| `--csv` | Output as CSV |
| `--markdown` | Output as Markdown |
| `--quiet` | Suppress non-error output |
| `--vault <name>` | Target specific vault |
| `--help` | Show help |

## Complete Command List

### Vault Commands
```bash
obsidian vault list                    # List all open vaults
obsidian vault switch <name>           # Switch to named vault
obsidian vault path                    # Show current vault path
obsidian vault info                    # Show vault statistics
```

### Note Commands
```bash
obsidian create <name>                 # Create new note
obsidian create <name> --template <T>  # Create from template
obsidian create <name> --folder <F>    # Create in folder
obsidian read                          # Read active note
obsidian read <file>                   # Read specific note
obsidian read <file> --json            # Read as JSON
obsidian edit <file>                   # Edit note (opens in UI)
obsidian edit <file> --content "text"  # Set content directly
obsidian append <file> "text"         # Append to note
obsidian prepend <file> "text"        # Prepend to note
obsidian move <file> <new-path>       # Move note (preserves links)
obsidian rename <file> <new-name>     # Rename note (preserves links)
obsidian delete <file>                 # Delete note
obsidian copy <file> <new-path>       # Copy note
obsidian merge <file1> <file2>        # Merge two notes
obsidian diff <file>                   # Show version history
obsidian diff <file> --from 1 --to 3  # Compare versions
```

### Daily Note Commands
```bash
obsidian daily                         # Open today's daily note
obsidian daily:append "content"       # Append to daily note
obsidian daily:prepend "content"      # Prepend to daily note
obsidian daily --template <T>          # Open with template
obsidian yesterday                     # Open yesterday's note
obsidian tomorrow                      # Open tomorrow's note
obsidian periodic weekly              # Open weekly note
obsidian periodic monthly             # Open monthly note
obsidian periodic quarterly           # Open quarterly note
obsidian periodic yearly              # Open yearly note
```

### Search Commands
```bash
obsidian search "query"                # Search vault content
obsidian search "query" --json         # JSON results
obsidian search:files "pattern"        # Search file names
obsidian search:content "pattern"      # Search file contents
obsidian search:tags "#tag"           # Search by tag
obsidian search:properties "key:value" # Search by property
obsidian grep "regex"                  # Regex search
obsidian grep "regex" --path "dir/"   # Search in directory
```

### Tag Commands
```bash
obsidian tags                          # List all tags
obsidian tags counts                   # Tag frequency counts
obsidian tags counts --json            # JSON counts
obsidian tag add <tag> --files "*.md" # Add tag to files
obsidian tag remove <tag> --files "*.md" # Remove tag from files
obsidian tag rename <old> <new>       # Rename tag across vault
obsidian tag rename <old> <new> --files "*.md"
```

### Property (Frontmatter) Commands
```bash
obsidian properties:list               # List all properties
obsidian properties:list --json        # JSON list
obsidian properties:get <file> <key>  # Get property value
obsidian properties:set <file> <key> <value> # Set property
obsidian properties:set <file> <key> <value> --type text|number|date|checkbox|list|tags|links
obsidian properties:delete <file> <key> # Delete property
obsidian properties:rename <old> <new> # Rename property across vault
obsidian properties:clean              # Remove unused properties
```

### Task Commands
```bash
obsidian tasks                         # List all tasks
obsidian tasks --status done           # List completed tasks
obsidian tasks --status not-done       # List incomplete tasks
obsidian tasks daily                   # Tasks from daily note
obsidian tasks --tag <tag>             # Tasks with tag
obsidian tasks --due today            # Tasks due today
obsidian tasks --overdue              # Overdue tasks
obsidian task add "task text"          # Add task
obsidian task add "task" --due 2026-07-14
obsidian task add "task" --priority high
obsidian task toggle <task-id>       # Toggle completion
obsidian task delete <task-id>       # Delete task
obsidian task edit <task-id> "text"  # Edit task
```

### Graph Commands
```bash
obsidian graph                         # Open graph view
obsidian graph analyze                 # Graph statistics
obsidian graph analyze --json          # JSON statistics
obsidian backlinks <file>             # Show backlinks
obsidian backlinks <file> --json      # JSON backlinks
obsidian outgoing <file>              # Show outgoing links
obsidian outgoing <file> --json       # JSON outgoing links
obsidian orphans                       # Find orphaned notes
obsidian orphans --json                # JSON orphans
obsidian broken-links                  # Find broken links
obsidian broken-links --json           # JSON broken links
```

### Template Commands
```bash
obsidian template list                 # List templates
obsidian template list --json          # JSON template list
obsidian template apply <name> <file> # Apply template to file
obsidian template create <name>       # Create template
obsidian template delete <name>       # Delete template
obsidian template show <name>         # Show template content
```

### Folder Commands
```bash
obsidian folder list                   # List folders
obsidian folder create <path>          # Create folder
obsidian folder delete <path>          # Delete folder (if empty)
obsidian folder rename <old> <new>    # Rename folder
```

### Bookmark Commands
```bash
obsidian bookmark add <file>           # Add bookmark
obsidian bookmark remove <file>        # Remove bookmark
obsidian bookmark list                 # List bookmarks
obsidian bookmark list --json          # JSON bookmarks
```

### Attachment Commands
```bash
obsidian attachments list              # List attachments
obsidian attachments list --json       # JSON attachment list
obsidian attachments orphans           # Find orphaned attachments
```

### Workspace Commands
```bash
obsidian workspace list                # List saved workspaces
obsidian workspace save <name>         # Save current workspace
obsidian workspace load <name>         # Load workspace
obsidian workspace delete <name>       # Delete workspace
obsidian workspace switch <name>       # Switch workspace
obsidian pane list                     # List open panes
obsidian pane close                    # Close active pane
obsidian pane split                    # Split active pane
```

### Canvas Commands
```bash
obsidian canvas create <name>          # Create canvas
obsidian canvas list                   # List canvases
obsidian canvas export <file> --format png|svg # Export canvas
```

### Developer Commands
```bash
obsidian dev:reload                    # Reload plugins
obsidian dev:reload --plugin <id>     # Reload specific plugin
obsidian dev:inspect                   # Open dev tools
obsidian dev:screenshot                # Take screenshot
obsidian dev:console                   # Open console
obsidian dev:plugins list             # List installed plugins
obsidian dev:plugins enable <id>       # Enable plugin
obsidian dev:plugins disable <id>      # Disable plugin
obsidian dev:plugins install <id>      # Install from community
obsidian dev:plugins uninstall <id>    # Uninstall plugin
obsidian dev:themes list              # List themes
obsidian dev:themes enable <name>     # Enable theme
obsidian dev:snippets list            # List CSS snippets
obsidian dev:snippets enable <name>   # Enable snippet
obsidian dev:snippets disable <name>  # Disable snippet
```

### Export Commands
```bash
obsidian export pdf <file>             # Export note to PDF
obsidian export html <file>            # Export note to HTML
obsidian export markdown <file>        # Export note to markdown
obsidian export canvas <file> --format png|svg
```

### Sync Commands (requires Obsidian Sync)
```bash
obsidian sync status                   # Show sync status
obsidian sync now                      # Force sync now
obsidian sync conflicts                # Show sync conflicts
obsidian sync resolve <conflict>       # Resolve conflict
obsidian sync history <file>          # Show file history
```

### Config Commands
```bash
obsidian config get <key>             # Get config value
obsidian config set <key> <value>     # Set config value
obsidian config list                   # List config keys
obsidian config reset <key>           # Reset to default
```

### Help Commands
```bash
obsidian help                          # General help
obsidian help --all                    # All commands
obsidian help <command>                # Help for specific command
obsidian help search                   # Help for search
obsidian version                       # Show version
```

## TUI Mode

Enter TUI by running `obsidian` without arguments:
```bash
obsidian
# Then type commands interactively
# Supports autocomplete, history (Ctrl+R), reverse search
```

## Piping and Scripting Examples

```bash
# JSON output for jq processing
obsidian search "project" --json | jq '.[].path'

# Count tags
obsidian tags counts --json | jq 'length'

# List all markdown files
obsidian vault list --json | jq '.files[]'

# Find and replace across files
obsidian grep "old term" --json | jq -r '.[].path' | xargs -I {} sed -i 's/old term/new term/g' {}

# Daily note automation
obsidian daily:append content="$(date): Morning standup"

# Create meeting note with template
obsidian create name="Team Sync $(date +%F)" template=Meeting folder="Meetings/"

# Weekly backup script
obsidian export markdown "Weekly Review" > /backups/weekly-$(date +%F).md
```

## Exit Codes

| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Vault not found |
| 3 | File not found |
| 4 | Invalid arguments |
| 5 | Obsidian not running (when required) |
| 6 | Permission denied |

---

*Based on Obsidian CLI v1.12.4+. Commands may vary by version.*
