1. Introduction: The Potential of Obsidian and the Command Line Interface (CLI)
Obsidian is used by many for its flexibility and powerful linking features, but introducing a Command Line Interface (CLI) enables further utilization, such as terminal-based operations, script-based automation, and integration with other tools. This article focuses on two major tools: the official Obsidian CLI and the community-made NotesMD CLI (formerly Obsidian CLI). We will compare their features, functionality, installation methods, and suitable use cases to help users choose the optimal CLI.
2. What is Obsidian CLI?
A CLI (Command Line Interface) is an interface that allows you to operate a computer using text commands instead of mouse operations (e.g., Windows Command Prompt, macOS/Linux Terminal). The biggest advantage of using a CLI with Obsidian is the ability to automate routine tasks such as creating, searching, listing, and generating reports for notes via scripts, which leads to increased productivity and focus on creative work. Primary use cases include task automation through scripting, integration with other tools, and bridging Obsidian data for external processing.
3. The Full Scope of the Official Obsidian CLI
3.1. The Emergence and Background of the Official CLIOn February 11, 2024, the Obsidian team officially announced the "Official Command Line Interface (CLI)." This was introduced as an early access feature in Obsidian version 1.12 and later, and is primarily available to users with a Catalyst license. With official support, controlling Obsidian from the terminal has reached a new level, opening up significant possibilities for developers and users seeking advanced automation.
3.2. Main Functions and Features of the Official CLIThe official Obsidian CLI makes almost all Obsidian GUI operations executable from the terminal and also supports an interactive TUI (Terminal User Interface).
Covers almost all GUI operations: Over 100 commands are available, including note creation, opening, searching, template application, task management, plugin management, and JavaScript execution.
Interactive TUI: Entering TUI mode by executing the obsidian command allows for efficient operation through auto-complete, command history, and reverse search (Ctrl+R) features.
Developer-oriented commands: Elements can be inspected, screenshots taken, and plugins reloaded directly from the CLI.
Setup is simple, but please note the license requirements.
Installation Requirements:
• Obsidian version 1.12.x or higher
• Catalyst license (any tier) required (early access)
• Obsidian installer version 1.11.7 or higher
Setup procedure: Simply go to "General" in Obsidian settings and enable "Command line interface." Note that the official CLI requires the Obsidian app to be running in the background.
特定のノートを開く obsidian open "私の今日のデイリーノート.md" 情報を検索する obsidian search "プロジェクトX"
4. Community-made CLI Tool: Focusing on NotesMD CLI
4.1. What is NotesMD CLI (formerly Obsidian CLI)?A community-made tool that was used even before the official CLI appeared. It is developed in the Go language and is characterized by its lightweight and fast operation. Its purpose is to directly manipulate Obsidian note files (Markdown files).
4.2. Key Features and Benefits of NotesMD CLIThe greatest appeal of this tool is that it functions even when the Obsidian app is not running. It is highly suitable for background processing and integration into CI/CD pipelines. Additionally, you can open notes in your preferred editor, such as VS Code, using the --editor flag.
5. Official vs. Community Version: Which Obsidian CLI is for You?
5.1. Points for ChoosingIf you want tight integration with the Obsidian GUI or to automate the operation of existing plugins, the official CLI is the best choice. On the other hand, if you prioritize lightweight performance or want to perform processing on the server side without launching the app, NotesMD CLI is recommended.
6. Tips for Terminal Automation with Obsidian CLI
Through automation, you can reduce the time and effort spent on repetitive routine tasks, allowing you to focus on creative work.
6.1. Practical Examples of Script CreationFor example, a script that automatically creates today's daily note, applies a specific template, and opens it would look like this:
DAILY_NOTE_NAME=$(date +"%Y-%m-%d_DailyNote.md") obsidian create "Daily Notes/$DAILY_NOTE_NAME" --template "Daily Note Template" obsidian open "Daily Notes/$DAILY_NOTE_NAME"
7. Conclusion
Which CLI you choose depends on whether you have a Catalyst license, the depth of integration required with the Obsidian app, and your specific automation goals. By leveraging the CLI, you can automate routine tasks, integrate with other tools, and perform complex information processing, enabling you to make more effective use of your time for organizing thoughts and deepening knowledge in Obsidian.
References
Obsidian Official CLI Announcement: https://obsidian.md/blog/official-cli/
NotesMD CLI (Formerly Obsidian CLI) Repository: https://github.com/Y滑/notesmd
Obsidian Help Documentation - Command Line Interface: https://help.obsidian.md/Extending+Obsidian/CLI