obsidian-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseobsidian-cli - Control Obsidian from the Terminal
obsidian-cli - 从终端控制 Obsidian
Keyword:·obsidian cli·obsidian uri·obsidian daily note commandobsidian plugin reload cliUse this skill for the official desktop CLI. If the user needs sync without the desktop app, that is Obsidian Headless, not this skill.
Obsidian CLI is the official command line interface for controlling a running Obsidian app from the terminal. It supports single commands, an interactive TUI, vault and file targeting, note operations, search, tags, tasks, and developer commands. Official docs also link it closely with the URI protocol for cross-app automation.
obsidian://关键词:·obsidian cli·obsidian uri·obsidian daily note commandobsidian plugin reload cli本技能适用于官方桌面端 CLI。如果用户需要在无桌面应用的情况下同步,属于 Obsidian Headless 的范畴,不适用本技能。
Obsidian CLI 是官方提供的命令行接口,可用于从终端控制运行中的 Obsidian 应用。它支持单命令执行、交互式 TUI、vault 和文件定向操作、笔记操作、搜索、标签、任务以及开发者命令。官方文档也明确说明它和 URI 协议深度关联,可用于跨应用自动化。
obsidian://When to use this skill
何时使用本技能
- Enable and verify the official Obsidian CLI registration
- Run one-shot commands such as ,
obsidian help,obsidian daily, orobsidian readobsidian search - Open the interactive TUI with autocomplete and history
- Target a specific vault with or
vault=<name>vault=<id> - Target a specific note with or
file=<name>path=<path> - Copy command output with
--copy - Use developer commands for plugin and theme work such as ,
devtools,plugin:reload, anddev:screenshoteval - Launch or generate URIs for open, new, daily, unique, search, and callback-based workflows
obsidian://
- 启用并验证官方 Obsidian CLI 的注册状态
- 运行单次命令,例如 、
obsidian help、obsidian daily或obsidian readobsidian search - 打开带自动补全和历史记录功能的交互式 TUI
- 通过 或
vault=<名称>指定特定 vaultvault=<id> - 通过 或
file=<名称>指定特定笔记path=<路径> - 配合 参数复制命令输出结果
--copy - 使用面向插件和主题开发的开发者命令,例如 、
devtools、plugin:reload和dev:screenshoteval - 启动或生成 URI,用于打开、新建、每日笔记、唯一笔记、搜索和基于回调的工作流
obsidian://
Instructions
使用指南
Step 1: Enable and verify the CLI
步骤 1:启用并验证 CLI
Use the official app flow first:
- Upgrade to the installer and early access versions required by the docs
- In Obsidian, go to
Settings -> General - Enable
Command line interface - Follow the prompt to register the CLI
Run the local helper:
bash
bash scripts/install.shWhat to remember:
- The docs currently say CLI usage requires the Obsidian installer
1.12 - The same page also says to upgrade to the latest installer and the latest early access
1.11.71.12.x - The app must be running, or the first CLI command launches it
- Linux packaging may need extra symlink or PATH work
Treat those version strings exactly as current official docs, not as inferred packaging logic.
优先使用官方应用内的流程操作:
- 升级到文档要求的安装包版本和早期访问版本
- 在 Obsidian 中,进入
设置 -> 通用 - 启用
命令行接口 - 按照提示完成 CLI 注册
运行本地辅助脚本:
bash
bash scripts/install.sh注意事项:
- 目前文档说明使用 CLI 需要 Obsidian 版本安装包
1.12 - 同一份文档也要求升级到最新的 安装包和最新的
1.11.7早期访问版本1.12.x - 应用必须处于运行状态,否则第一条 CLI 命令会自动启动应用
- Linux 安装包可能需要额外的软链接或 PATH 配置
请严格按照官方当前文档标注的版本号操作,不要自行推断安装逻辑。
Step 2: Choose single-command mode or the TUI
步骤 2:选择单命令模式或 TUI 模式
Run a single command:
bash
obsidian helpOpen the terminal interface:
bash
obsidian
helpUse the TUI when the user wants autocomplete, command history, and reverse search. Use single-command mode for scripts, automation, and shell aliases.
运行单次命令:
bash
obsidian help打开终端交互界面:
bash
obsidian
help当用户需要自动补全、命令历史和反向搜索功能时使用 TUI 模式。在编写脚本、自动化流程和 shell 别名场景下使用单命令模式。
Step 3: Target the right vault and file
步骤 3:定向到正确的 vault 和文件
Vault targeting rules:
- If the current working directory is a vault, that vault is used by default
- Otherwise, the active vault is used
- or
vault=<name>must be the first parameter before the commandvault=<id>
Examples:
bash
obsidian vault=Notes daily
obsidian vault="My Vault" search query="meeting notes"File targeting rules:
- uses wikilink-style resolution by file name
file=<name> - requires the exact path from the vault root
path=<path> - If neither is provided, many commands default to the active file
Examples:
bash
obsidian read file=Recipe
obsidian read path="Templates/Recipe.md"Move the targeting details into references/vault-and-file-targeting.md.
vault 定向规则:
- 如果当前工作目录是一个 vault,默认使用该 vault
- 否则使用当前激活的 vault
- 或
vault=<名称>必须是命令前的第一个参数vault=<id>
示例:
bash
obsidian vault=Notes daily
obsidian vault="My Vault" search query="meeting notes"文件定向规则:
- 采用 wiki 链接风格的文件名解析逻辑
file=<名称> - 需要传入从 vault 根目录开始的精确路径
path=<路径> - 如果两者都未提供,多数命令默认使用当前激活的文件
示例:
bash
obsidian read file=Recipe
obsidian read path="Templates/Recipe.md"请将定向相关的细节整理到 references/vault-and-file-targeting.md。
Step 4: Use the command families that match the job
步骤 4:使用匹配需求的命令族
Start with the everyday commands:
dailydaily:appendsearchreadcreatetagstasksdiff
General commands:
helpversionreloadrestart
Developer-oriented commands:
devtoolsplugin:reloaddev:screenshoteval
These developer commands are especially useful for plugin and theme workflows because the docs explicitly position them for automatic testing and debugging.
See references/commands-and-developer-tools.md for a compact command map.
日常使用优先选择通用命令:
dailydaily:appendsearchreadcreatetagstasksdiff
基础命令:
helpversionreloadrestart
面向开发者的命令:
devtoolsplugin:reloaddev:screenshoteval
这些开发者命令对插件和主题开发工作流特别有用,官方文档明确说明它们是为自动化测试和调试设计的。
查看 references/commands-and-developer-tools.md 获取精简的命令映射表。
Step 5: Use flags and output features deliberately
步骤 5:合理使用参数和输出特性
Parameter rules:
- Parameters use
name=value - Wrap values with spaces in quotes
- Boolean switches are bare flags such as or
openoverwrite - Use for newlines and
\nfor tabs in content strings\t
Examples:
bash
obsidian create
obsidian create name=Note content="Hello world"
obsidian create name=Note content="Hello" open overwrite
obsidian create name=Note content="# Title\n\nBody text"Output helper:
bash
obsidian read --copy
obsidian search query="TODO" --copyMany listing commands also expose parameters such as , , , , or .
format=jsontsvcsvmdpaths参数规则:
- 参数采用 格式
名称=值 - 带空格的参数值需要用引号包裹
- 布尔开关是无值参数,例如 或
openoverwrite - 内容字符串中使用 表示换行,
\n表示制表符\t
示例:
bash
obsidian create
obsidian create name=Note content="Hello world"
obsidian create name=Note content="Hello" open overwrite
obsidian create name=Note content="# Title\n\nBody text"输出辅助参数:
bash
obsidian read --copy
obsidian search query="TODO" --copy很多列表类命令还提供 参数,支持 、、、 或 等输出格式。
format=jsontsvcsvmdpathsStep 6: Use obsidian://
URI workflows for external automation
obsidian://步骤 6:使用 obsidian://
URI 工作流实现外部自动化
obsidian://The official URI actions include:
opennewdailyuniquesearchchoose-vault
Examples:
text
obsidian://open?vault=my%20vault&file=my%20note
obsidian://new?vault=my%20vault&name=my%20note
obsidian://daily?vault=my%20vault
obsidian://search?vault=my%20vault&query=ObsidianImportant URI rules:
- Encode values properly, especially spaces and
/ - overrides
path=andvaultfile - controls opening location
paneType=tab|split|window - is desktop-only
paneType=window - and
x-successsupport callback flows on supported endpointsx-error
Use references/uri-and-callbacks.md for the URI-specific behavior and Hook integration notes.
官方支持的 URI 操作包括:
opennewdailyuniquesearchchoose-vault
示例:
text
obsidian://open?vault=my%20vault&file=my%20note
obsidian://new?vault=my%20vault&name=my%20note
obsidian://daily?vault=my%20vault
obsidian://search?vault=my%20vault&query=ObsidianURI 重要规则:
- 正确编码参数值,特别是空格和 字符
/ - 参数会覆盖
path=和vault参数file - 控制打开位置
paneType=tab|split|window - 仅支持桌面端
paneType=window - 支持的端点可以通过 和
x-success实现回调流程x-error
查看 references/uri-and-callbacks.md 获取 URI 专属行为和 Hook 集成说明。
Step 7: Respect the limitations
步骤 7:明确使用限制
- CLI automation is for the desktop app, not headless sync
- requires the Daily notes plugin to be enabled
daily - requires the Unique note creator plugin to be enabled
unique - Linux registration may require manual symlinks, PATH updates, or packaging-specific fixes
- Developer commands can change app or plugin state, so use them intentionally
- CLI 自动化仅适用于桌面端应用,不适用于无界面同步场景
- 命令需要启用每日笔记插件
daily - 命令需要启用唯一笔记创建器插件
unique - Linux 系统注册可能需要手动配置软链接、PATH 或特定安装包的修复操作
- 开发者命令会修改应用或插件状态,请谨慎使用
Examples
示例
Example 1: Verify CLI registration
示例 1:验证 CLI 注册状态
bash
bash scripts/install.shbash
bash scripts/install.shExample 2: Open the TUI
示例 2:打开 TUI
bash
bash scripts/run-command.shbash
bash scripts/run-command.shExample 3: Open today's daily note
示例 3:打开今日的每日笔记
bash
bash scripts/run-command.sh dailybash
bash scripts/run-command.sh dailyExample 4: Append a task to today's daily note
示例 4:向今日的每日笔记追加任务
bash
bash scripts/run-command.sh daily:append content="- [ ] Buy groceries"bash
bash scripts/run-command.sh daily:append content="- [ ] Buy groceries"Example 5: Search a specific vault
示例 5:搜索指定 vault
bash
bash scripts/run-command.sh vault="My Vault" search query="meeting notes"bash
bash scripts/run-command.sh vault="My Vault" search query="meeting notes"Example 6: Read a file by name or exact path
示例 6:通过文件名或精确路径读取文件
bash
bash scripts/run-command.sh read file=Recipe
bash scripts/run-command.sh read path="Templates/Recipe.md" --copybash
bash scripts/run-command.sh read file=Recipe
bash scripts/run-command.sh read path="Templates/Recipe.md" --copyExample 7: Reload a plugin you are developing
示例 7:重载你正在开发的插件
bash
bash scripts/run-command.sh plugin:reload id=my-pluginbash
bash scripts/run-command.sh plugin:reload id=my-pluginExample 8: Take a screenshot from the app
示例 8:从应用内截取截图
bash
bash scripts/run-command.sh dev:screenshot path=screenshot.pngbash
bash scripts/run-command.sh dev:screenshot path=screenshot.pngExample 9: Open a note via URI
示例 9:通过 URI 打开笔记
bash
bash scripts/open-uri.sh 'obsidian://open?vault=my%20vault&file=my%20note'bash
bash scripts/open-uri.sh 'obsidian://open?vault=my%20vault&file=my%20note'Best practices
最佳实践
- Start with or the TUI before assuming a command family name.
obsidian help - Put first when you need deterministic multi-vault automation.
vault= - Prefer when duplicate file names make wikilink-style
path=resolution ambiguous.file= - Use when the result needs to feed another tool or model without extra shell parsing.
--copy - Treat developer commands like ,
plugin:reload, andevalas operational tools, not casual shortcuts.dev:screenshot - Keep CLI automation separate from Headless Sync workflows; they solve different problems.
- URI values must be encoded correctly or the action may be misinterpreted.
- On Linux, check registration, symlinks, and before assuming the CLI is broken.
PATH
- 在猜测命令族名称之前,优先运行 或使用 TUI 查询。
obsidian help - 如果你需要确定性的多 vault 自动化流程,请将 参数放在最前面。
vault= - 当存在重复文件名导致 wiki 链接风格的 解析出现歧义时,优先使用
file=参数。path= - 当输出结果需要传入其他工具或模型,且不需要额外 shell 解析时,使用 参数。
--copy - 请将 、
plugin:reload、eval等开发者命令作为运维工具使用,不要作为日常快捷方式。dev:screenshot - 请将 CLI 自动化和无界面同步工作流区分开,两者解决的是不同问题。
- URI 值必须正确编码,否则操作可能会被错误解析。
- 在 Linux 系统下,在判定 CLI 故障之前,请先检查注册状态、软链接和 配置。
PATH
References
参考资料
- references/installation-and-troubleshooting.md
- references/vault-and-file-targeting.md
- references/commands-and-developer-tools.md
- references/uri-and-callbacks.md
- scripts/install.sh
- scripts/run-command.sh
- scripts/open-uri.sh
- Obsidian CLI
- Obsidian URI
- references/installation-and-troubleshooting.md
- references/vault-and-file-targeting.md
- references/commands-and-developer-tools.md
- references/uri-and-callbacks.md
- scripts/install.sh
- scripts/run-command.sh
- scripts/open-uri.sh
- Obsidian CLI
- Obsidian URI