Obsidian CLI — Obsidian 命令行工具
v1.12技能 for the official Obsidian 命令行工具 (v1.12+). Complete vault 自动化 including files, dAIly notes, 搜索, tasks, tags, properties, links, bookmarks, bases, templates, themes, 插件s, 同步, publish, workspaces, and developer 工具s.
运行时依赖
版本
obsidian publish:状态 new # New files to publish
安装命令
点击复制技能文档
Obsidian 命令行工具 (Official, v1.12+)
The official Obsidian 命令行工具 connects to a 运行ning Obsidian instance via IPC. Requires Obsidian 1.12+ with 命令行工具 enabled in 设置tings > General.
Prerequisites Obsidian 1.12+ 安装ed and 运行ning 命令行工具 enabled: 设置tings > General > Enable 命令行工具 The obsidian binary must be in your PATH
导入ant: Obsidian must be 运行ning for 命令行工具 commands to work. The 命令行工具 communicates with the 运行ning instance via IPC.
平台 Notes macOS/Windows: The Obsidian 安装er typically places the 命令行工具 binary in PATH automatically. Linux: You may need a wr应用er script to avoid Electron flag injection that breaks 命令行工具 arg parsing. Ensure your wr应用er is in PATH before the 系统 obsidian binary. If 运行ning as a 服务, ensure PrivateTmp=false for IPC to work. Complete Command Reference Basics obsidian version # Show Obsidian version obsidian help # 列出 all avAIlable commands obsidian vault # Show vault 信息 (name, path, files, size) obsidian vault 信息=name # Just vault name obsidian vault 信息=path # Just vault path obsidian reload # Reload the vault obsidian re启动 # Re启动 the 应用
DAIly Notes obsidian dAIly # Open today's dAIly note obsidian dAIly silent # Open without focusing obsidian dAIly:read # Read dAIly note contents obsidian dAIly:应用end content="- [ ] Task" # 应用end to dAIly note obsidian dAIly:prepend content="# Header" # Prepend to dAIly note obsidian dAIly paneType=tab # Open in new tab (tab|split|window)
Files obsidian read file=Recipe # Read by name (wikilink resolution) obsidian read path="Work/notes.md" # Read by exact path obsidian file file=Recipe # Show file 信息 (path, size, dates) obsidian 创建 name=Note content="Hello" # 创建 a new note obsidian 创建 name=Note template=Travel # 创建 from template obsidian 创建 path="Work/note.md" content="text" # 创建 at exact path obsidian 创建 name=Note overwrite # Overwrite if exists obsidian 创建 name=Note silent newtab # 创建 silently in new tab obsidian open file=Recipe # Open in Obsidian obsidian open file=Recipe newtab # Open in new tab obsidian 删除 file=Old # 删除 (to trash) obsidian 删除 file=Old permanent # 删除 permanently obsidian move file=Old to="归档/Old.md" # Move/rename (include .md in tar获取) obsidian 应用end file=记录 content="Entry" # 应用end to file obsidian 应用end file=记录 content="text" inline # 应用end inline (no newline) obsidian prepend file=记录 content="Header" # Prepend to file obsidian unique name="Meeting" content="notes" # 创建 note with unique timestamp obsidian wordcount file=Note # Word and character count obsidian wordcount file=Note words # Words only obsidian wordcount file=Note characters # Characters only obsidian random # Open a random note obsidian random:read # Read a random note obsidian random folder="Work" # Random note from folder obsidian recents # 列出 recently opened files obsidian recents total # Count of recent files
搜索 obsidian 搜索 查询="meeting notes" # 搜索 vault obsidian 搜索 查询="TODO" matches # Show match 上下文 obsidian 搜索 查询="project" path="Work" limit=10 # Scoped 搜索 obsidian 搜索 查询="test" 格式化=json # JSON 输出 obsidian 搜索 查询="Bug" case # Case-sensitive 搜索 obsidian 搜索 查询="error" total # Count matches only obsidian 搜索:open 查询="TODO" # Open 搜索 view in Obsidian
Tasks obsidian tasks dAIly # Tasks from dAIly note obsidian tasks dAIly todo # Incomplete dAIly tasks obsidian tasks dAIly done # Completed dAIly tasks obsidian tasks all todo # All incomplete tasks in vault obsidian tasks file=Recipe done # Completed tasks in file obsidian tasks verbose # Tasks with file paths + line numbers obsidian tasks total # Count of tasks obsidian tasks 状态="/" # Tasks with custom 状态 character obsidian task dAIly line=3 toggle # Toggle task completion obsidian task dAIly line=3 done # Mark task done obsidian task dAIly line=3 todo # Mark task incomplete obsidian task ref="Work/todo.md:5" toggle # Toggle by file:line reference obsidian task dAIly line=3 状态="/" # 设置 custom 状态
Tags & Properties # Tags obsidian tags all counts # All tags with counts obsidian tags all