Command Line Interface to open folders (and files) in Obsidian from the terminal

I followed @RasmusM’s instructions for Mac users above.
That worked like a charm. Never knew there was a “Copy Obsidian URL” in Obsidian mouse right click on a note!!! Fantastic!! Thank you!!

The magic that worked is:

// If you want a Note to open directly, use the full URL 
// you get from right-click and Copy Obsidian URL on 
// the Obsidian note. 
// Eg:

open "obsidian://open?vault=TheVaultName&file=TheNoteName"

// If you want to open the vault as is (last state, with your 
// last note that was working on, just use the vault from that
// URL constructed as mentioned above.
// Eg:

open "obsidian://open?vault=projects"

//Notice how the part after the '&' sign that is related to the 
// file name (aka the Note name) is now gone.

Just to add a bit more, the Mac open command can be used to
open a specific application URL or the application itself from the
command line.

// Following opens the application (-a option)

open -a obsidian

// Now the URL, to open the application and issue a command

open "obsidian://open?vault=projects&file=MyHubNote"

Enjoy!


Update on 01/03/2025:
I’ve tried this method for such a long time, but find it is better if any folder can be opened with Obsidian via the terminal, so that Obsidian can be used to do its job - to manage a great documentation!

Link to the new comment:

4 Likes