obsidian-cli by jackal092927/obsidian-official-cli-skills
npx skills add https://github.com/jackal092927/obsidian-official-cli-skills --skill obsidian-cli使用 CLI 当你需要 Obsidian 的索引或应用功能时:搜索、反向链接、链接、标签、任务、属性、数据库、模板、大纲、孤立文件、未解析链接
使用文件工具(读取/写入/编辑/Grep/Glob)用于:简单的文件读写、批量文本替换、跨文件 grep — 不依赖应用
经验法则:如果 Obsidian 的索引能增加价值,使用 CLI。如果是纯文本操作,使用文件工具。
obsidian <command> [param=value ...] [flag ...]
vault="My Vault" 作为第一个参数,或在知识库目录内运行path=exact/path.md(相对于知识库)对比 file=name(链接式解析)key=value — 包含空格的数值需要引号:name="My Note"广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
=silentoverwritecountstotal\n 表示换行,\t 表示制表符format=json(搜索,数据库:查询),format=tsv(属性,标签)--copy 以复制输出obsidian read path=<path> # 读取文件内容
obsidian append path=<path> content="<text>" # 追加到文件
obsidian prepend path=<path> content="<text>" # 在前置元数据后预置内容
obsidian create name=<name> content="<text>" silent # 创建文件(安全 — 不会覆盖)
obsidian create name=<name> template=<template> overwrite silent # 从模板创建
obsidian move path=<from> to=<to> # 移动/重命名文件
obsidian delete path=<path> # 移动到系统回收站(安全)
注意事项:
silent 的 create 会在 Obsidian 界面中打开文件 — 在代理操作期间始终添加 silent。create 不会自动创建目录 — 如果父文件夹不存在,请先通过 Bash 使用 mkdir -p。template= 的 create 可能会将文件放置在模板配置的文件夹中,忽略 path=。创建后使用 search 或 files 验证实际路径。obsidian daily # 打开今天的每日笔记
obsidian daily:read # 读取每日笔记内容
obsidian daily:append content="<text>" # 追加到每日笔记
obsidian daily:prepend content="<text>" # 预置到每日笔记
obsidian property:set name=<key> value=<val> path=<path> # 设置属性
obsidian property:set name=<key> value=<val> type=<type> path=<path> # 设置并指定类型
obsidian property:read name=<key> path=<path> # 读取一个属性
obsidian property:remove name=<key> path=<path> # 移除属性
obsidian properties path=<path> # 列出所有属性
obsidian properties path=<path> format=tsv # 以 TSV 格式列出(键\t值)
obsidian search query="<text>" # 搜索知识库(文件路径)
obsidian search query="<text>" path=<folder> limit=10 # 限定范围的搜索
obsidian search query="<text>" format=json # 路径的 JSON 数组
obsidian search query="<text>" format=json matches # 包含行号的结构化 JSON(推荐)
obsidian search query="<text>" matches # 包含匹配行的文本格式
提示:format=json matches 返回 [{"file":"path","matches":[{"line":N,"text":"..."}]}] — 用于编程式搜索。
obsidian tags all counts # 列出知识库中所有标签及其数量
obsidian tags all counts sort=count # 按频率排序
obsidian tag name=<tag> # 包含特定标签的文件
obsidian tasks all todo # 知识库范围内未完成的任务
obsidian tasks all done # 知识库范围内已完成的任务
obsidian tasks daily # 每日笔记中的任务
obsidian tasks path=<path> # 文件/文件夹中的任务
obsidian task ref="<path>:<line>" toggle # 切换任务状态
obsidian task ref="<path>:<line>" done # 标记为完成
注意:不带 all 的 tags 仅列出活动/指定文件的标签。注意:不带范围(all、daily、path=)的 tasks 默认为活动文件 — 使用 tasks all 获取知识库范围的结果。
obsidian backlinks path=<path> # 指向文件的入链
obsidian backlinks path=<path> counts # 包含链接数量
obsidian links path=<path> # 文件发出的出链
obsidian unresolved # 损坏/未解析的链接
obsidian orphans # 没有入链的文件
obsidian deadends # 没有出链的文件
obsidian files folder=<path> ext=md # 列出文件夹中的文件
obsidian folders # 列出所有文件夹
obsidian outline path=<path> # 文件的标题结构
obsidian bases # 列出 .base 文件
obsidian base:query path=<path> format=json # 查询数据库
obsidian base:query path=<path> view=<name> format=json # 查询特定视图
obsidian templates # 列出可用模板
obsidian template:read name=<name> # 读取模板源码
obsidian template:read name=<name> resolve # 渲染并填充变量
未经用户明确请求,切勿运行:
eval — 任意代码执行delete permanent — 绕过回收站plugin:install / plugin:uninstall — 修改插件状态dev:cdp — Chrome DevTools 协议访问优先使用安全模式:
append / prepend 而非完全覆盖文件overwrite 标志的 create 是安全的(不会替换现有文件)obsidian vault # 确认 CLI 连接 — 返回知识库名称、路径、文件数量
obsidian version # 显示 CLI 版本(例如 "1.12.1 (installer 1.11.4)")
| 症状 | 可能原因 | 操作 |
|---|---|---|
obsidian version 失败 | CLI 未安装或不在 PATH 中 | 回退到文件工具 |
| 命令挂起或超时 | Obsidian 应用未运行 | 启动 Obsidian 或使用文件工具 |
| "未知命令" | CLI 版本过旧 | 运行 obsidian help 检查可用命令 |
| 搜索/标签返回空结果 | 知识库索引未就绪 | 稍等片刻,重试,或使用 Grep 作为回退 |
通用回退方案:如果 CLI 不可用,使用 读取/写入/编辑/Grep/Glob 进行文件操作。CLI 需要 Obsidian 桌面应用正在运行。
每周安装量
104
代码仓库
GitHub 星标数
21
首次出现
2026年2月13日
安全审计
安装于
opencode101
github-copilot98
kimi-cli98
gemini-cli79
codex79
cursor77
Use CLI when you need Obsidian's index or app features: search, backlinks, links, tags, tasks, properties, bases, templates, outline, orphans, unresolved links
Use file tools (Read/Write/Edit/Grep/Glob) for: simple file read/write, bulk text replacement, grep across files — no app dependency
Rule of thumb: if Obsidian's index adds value, use CLI. If it's plain text manipulation, use file tools.
obsidian <command> [param=value ...] [flag ...]
vault="My Vault" as first param, or run from inside vault dirpath=exact/path.md (vault-relative) vs file=name (link-style resolution)key=value — quote values with spaces: name="My Note"= — e.g. silent, overwrite, counts, total\n for newline, \t for tab in content stringsformat=json (search, base:query), format=tsv (properties, tags)--copy to copy outputobsidian read path=<path> # read file content
obsidian append path=<path> content="<text>" # append to file
obsidian prepend path=<path> content="<text>" # prepend after frontmatter
obsidian create name=<name> content="<text>" silent # create file (safe — won't overwrite)
obsidian create name=<name> template=<template> overwrite silent # create from template
obsidian move path=<from> to=<to> # move/rename file
obsidian delete path=<path> # move to system trash (safe)
Gotchas:
create without silent opens the file in Obsidian's UI — always add silent during agent operations.create doesn't auto-create directories — use mkdir -p via Bash first if the parent folder doesn't exist.create with template= may place the file in the template's configured folder, ignoring path=. Verify the actual path with search or files after creation.obsidian daily # open today's daily note
obsidian daily:read # read daily note content
obsidian daily:append content="<text>" # append to daily note
obsidian daily:prepend content="<text>" # prepend to daily note
obsidian property:set name=<key> value=<val> path=<path> # set property
obsidian property:set name=<key> value=<val> type=<type> path=<path> # set with explicit type
obsidian property:read name=<key> path=<path> # read one property
obsidian property:remove name=<key> path=<path> # remove property
obsidian properties path=<path> # list all properties
obsidian properties path=<path> format=tsv # list as TSV (key\tvalue)
obsidian search query="<text>" # search vault (file paths)
obsidian search query="<text>" path=<folder> limit=10 # scoped search
obsidian search query="<text>" format=json # JSON array of paths
obsidian search query="<text>" format=json matches # structured JSON with line numbers (preferred)
obsidian search query="<text>" matches # text format with matching lines
Tip: format=json matches returns [{"file":"path","matches":[{"line":N,"text":"..."}]}] — use this for programmatic search.
obsidian tags all counts # list ALL vault tags with counts
obsidian tags all counts sort=count # sorted by frequency
obsidian tag name=<tag> # files with specific tag
obsidian tasks all todo # vault-wide open tasks
obsidian tasks all done # vault-wide completed tasks
obsidian tasks daily # tasks from daily note
obsidian tasks path=<path> # tasks in file/folder
obsidian task ref="<path>:<line>" toggle # toggle task status
obsidian task ref="<path>:<line>" done # mark done
Note: tags without all lists tags for the active/specified file only. Note: tasks without a scope (all, daily, path=) defaults to the active file — use tasks all for vault-wide results.
obsidian backlinks path=<path> # incoming links to file
obsidian backlinks path=<path> counts # with link counts
obsidian links path=<path> # outgoing links from file
obsidian unresolved # broken/unresolved links
obsidian orphans # files with no incoming links
obsidian deadends # files with no outgoing links
obsidian files folder=<path> ext=md # list files in folder
obsidian folders # list all folders
obsidian outline path=<path> # heading structure of file
obsidian bases # list .base files
obsidian base:query path=<path> format=json # query a base
obsidian base:query path=<path> view=<name> format=json # query specific view
obsidian templates # list available templates
obsidian template:read name=<name> # read template source
obsidian template:read name=<name> resolve # render with variables filled
Never run without explicit user request:
eval — arbitrary code executiondelete permanent — bypasses trashplugin:install / plugin:uninstall — modifies plugin statedev:cdp — Chrome DevTools protocol accessPrefer safe patterns:
append / prepend over full file overwritecreate without overwrite flag is safe (won't replace existing files)obsidian vault # confirm CLI connection — returns vault name, path, file count
obsidian version # show CLI version (e.g. "1.12.1 (installer 1.11.4)")
| Symptom | Likely cause | Action |
|---|---|---|
obsidian version fails | CLI not installed or not on PATH | Fall back to file tools |
| Command hangs or times out | Obsidian app not running | Start Obsidian or use file tools |
| "Unknown command" | CLI version too old | Run obsidian help to check available commands |
| Empty results from search/tags | Vault index not ready | Wait a moment, retry, or use Grep as fallback |
General fallback : if CLI is unavailable, use Read/Write/Edit/Grep/Glob for file operations. The CLI requires the Obsidian desktop app to be running.
Weekly Installs
104
Repository
GitHub Stars
21
First Seen
Feb 13, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode101
github-copilot98
kimi-cli98
gemini-cli79
codex79
cursor77
Python PDF处理教程:合并拆分、提取文本表格、创建PDF文件
62,800 周安装