https://github.com/ckelsoe/obsidian-shell-path-copy
An Obsidian plugin for copying file and folder paths with shell-friendly formatting.
Today's workflows often involve using Obsidian alongside terminal-based AI assistants, such as Claude Code or Gemini CLI. You might be using Obsidian on Windows, macOS, Linux, or even on mobile devices like iPads and Android tablets (which can run both Obsidian and terminal apps). Regardless of your setup, whether that's Obsidian on Windows with a WSL terminal, Obsidian on your iPad connected to a remote Linux server, or any other combination, you face the same challenge: copying file paths from Obsidian that work correctly in your target terminal environment.
In these scenarios, you need to copy file paths from your vault for use in shell commands or AI assistant prompts. Obsidian's native "Copy file path" command is buried in the command palette and only provides a single path format, which may not match your target system's requirements.
Shell Path Copy improves this workflow by:
- Adding path copying options directly to the right-click context menu in the file explorer.
- Providing both Linux/Mac and Windows path formats, ensuring you can get the correct format for your target environment, regardless of the device you are using.
Shell Path Copy offers a comprehensive set of features designed to streamline your workflow, all of which are configurable via its dedicated settings tab.
- Right-click menu integration: Adds "Copy Path" options to files and folders in the file explorer
- Command Palette Integration: Direct commands for each path format, respecting your display preferences
- Multiple path formats:
- Relative Paths - Path is relative to the vault root (Desktop and Mobile):
- Windows:
\doc\file.md - Linux and macOS:
/doc/file.md
- Windows:
- Absolute Path - Path is relative to the root of the filesystem (Desktop Only):
- Windows:
C:\Users\YourName\Documents\Obsidian\MyVault\doc\file.md - Linux and macOS:
/home/user/Documents/Obsidian/MyVault/doc/file.md
- Windows:
- File URL format (Desktop Only):
- Windows:
file:///C:/Users/YourName/Documents/Obsidian/MyVault/doc/file.md - Linux and macOS:
file:///home/user/Documents/Obsidian/MyVault/doc/file.md - Automatically handles platform-specific formatting
- URL-encodes special characters for compatibility
- Windows:
- Obsidian URL format:
obsidian://open?vault=MyVault&file=doc/file- Works on all platforms (desktop and mobile)
- Perfect for cross-linking from other applications
- Markdown Link format:
- Wiki-style:
[[filename]](default, perfect for Obsidian) - Standard markdown:
[filename.md](/path/filename.md)(universal compatibility)
- Wiki-style:
- Relative Paths - Path is relative to the vault root (Desktop and Mobile):
- Configurable display options: Choose which path formats appear in menus:
- Show both Windows and Linux/Mac options (default)
- Show Windows options only
- Show Linux/Mac options only
- Smart path wrapping: Automatically wraps paths using configurable delimiters to handle spaces properly. Options include:
- None:
path/to/file - Double Quotes:
"path/to/file" - Single Quotes:
'path/to/file' - Backticks: `path/to/file` (default - recommended for paths with spaces)
- None:
- Success notifications: Visual feedback when paths are copied
- Open Obsidian Settings
- Navigate to Community plugins
- Click Browse to open the Community Plugins browser
- Search for "Shell Path Copy"
- Click Install, then Enable
Use BRAT if you want to test beta or pre-release versions:
- Install the BRAT plugin from Community Plugins
- Open BRAT settings and click "Add Beta Plugin"
- Enter:
https://github.com/ckelsoe/obsidian-shell-path-copy - Click "Add Plugin"
- Enable "Shell Path Copy" in Settings → Community plugins
- Download
main.js,manifest.json, andstyles.cssfrom this repository - Create a folder named
shell-path-copyin your vault's.obsidian/plugins/directory - Copy the downloaded files into this folder
- Reload Obsidian
- Enable "Shell Path Copy" in Settings → Community Plugins
Shell Path Copy provides flexible ways to copy paths:
- Right-click any file or folder in the Obsidian file explorer.
- Select "Copy Path" from the context menu.
- Choose your desired format:
- Copy Linux/Mac Path: For Unix/Linux/macOS systems (e.g.,
/folder/file.md) - Copy Windows Path: For Windows systems (e.g.,
\folder\file.md) - Copy Absolute Path: For the full system path (Desktop Only)
- Copy as file:// URL: For file URL format (Desktop Only)
- Copy as Obsidian URL: For obsidian:// protocol links
- Copy as Markdown Link: For documentation and note-taking (e.g.,
[[filename]]or[filename.md](path))
- Copy Linux/Mac Path: For Unix/Linux/macOS systems (e.g.,
- The path is copied to your clipboard, wrapped in backticks by default.
- Paste it anywhere you need!
- Open the Command Palette (Ctrl/Cmd+P).
- Type "Shell Path Copy" or "Copy Path" to filter commands.
- Available commands depend on your settings:
- "Shell Path Copy: Copy as Linux/Mac path" (shown when set to "both" or "Linux/Mac only")
- "Shell Path Copy: Copy as Windows path" (shown when set to "both" or "Windows only")
- "Shell Path Copy: Copy as absolute path" (Desktop only)
- "Shell Path Copy: Copy as file:// URL" (Desktop only)
- "Shell Path Copy: Copy as Obsidian URL" (when enabled in settings)
- "Shell Path Copy: Copy as markdown link" (when enabled in settings)
- The path of the currently active file (or focused file in the explorer) will be copied.
Imagine you are viewing My-Project-Plan.md in Obsidian on your iPad. You are connected to your Linux development server using an SSH client like Termius. You need to tell a colleague (or an AI assistant like Gemini) to view the contents of that file on the server.
With Shell Path Copy:
- In Obsidian on your iPad, right-click on
My-Project-Plan.md. - Select "Copy Linux/Mac Path".
- The string
\/My-Project-Plan.md`` is now on your clipboard. - Paste it directly into your Termius session:
cat /My-Project-Plan.md
No manual editing, no mistakes, no context switching. It just works.
For desktop users who need to create clickable file:// URLs:
- Right-click any file or folder in the file explorer
- Select "Copy as file:// URL"
- The full file:// URL is copied to your clipboard
This is particularly useful for:
- Creating clickable links in browsers
- Working with applications that accept file:// URLs
- Documentation that needs absolute file references
- Opening files in external applications via URLs
Example outputs:
- Windows:
file:///C:/Users/John/Documents/vault/note.md - Linux:
file:///home/john/Documents/vault/note.md - macOS:
file:///Users/john/Documents/vault/note.md
For users who want to create clickable links that open files directly in Obsidian:
- Right-click any file in the file explorer
- Select "Copy as Obsidian URL"
- The full obsidian:// URL is copied to your clipboard
This is particularly useful for:
- Creating links from task managers (Todoist, OmniFocus, etc.)
- Linking from external documentation or wikis
- Building automation workflows
- Cross-app integration
Example output:
obsidian://open?vault=MyVault&file=Projects/Project%20Plan
For users who want to create internal links or documentation:
- Right-click any file in the file explorer
- Select "Copy as Markdown Link"
- Choose your preferred format in settings:
- Wiki-style (default):
[[My Document]]- Perfect for Obsidian internal linking - Standard markdown:
[My Document.md](/folder/My Document.md)- Universal markdown compatibility
- Wiki-style (default):
This is particularly useful for:
- Creating internal note references in Obsidian
- Documentation that uses markdown formatting
- Cross-referencing files in project notes
- Building linked knowledge bases
Notebook Navigator is a popular plugin that replaces Obsidian's default file explorer with an enhanced interface. If you use Notebook Navigator, you'll find that it includes some built-in path copying functionality.
| Feature | Shell Path Copy | Notebook Navigator |
|---|---|---|
| Copy vault-relative path | ✅ Linux/Mac & Windows formats | ✅ Single format |
| Copy absolute path | ✅ With configurable wrapping | ✅ Without wrapping |
| Copy file:// URL | ✅ | ❌ |
| Copy Obsidian URL | ✅ | ✅ |
| Copy markdown link | ✅ Wiki-style & standard | ❌ |
| Configurable path wrapping | ✅ (backticks, quotes, none) | ❌ |
| Platform-specific formats | ✅ (Windows vs Linux/Mac) | ❌ |
Shell Path Copy's context menu items only appear in Obsidian's native file explorer. However, you can still access all functionality through the Command Palette (Ctrl/Cmd+P):
- "Shell Path Copy: Copy as Linux/Mac path"
- "Shell Path Copy: Copy as Windows path"
- "Shell Path Copy: Copy as absolute path"
- "Shell Path Copy: Copy as file:// URL"
- "Shell Path Copy: Copy as Obsidian URL"
- "Shell Path Copy: Copy as markdown link"
These commands work on the currently active file or the focused file in either file explorer.
We have no current plans to integrate directly with Notebook Navigator's context menus. If you would like to see deeper integration between these plugins, please open an issue describing your use case. We'll consider investigating integration options if there is sufficient community interest.
- Sharing file locations with AI Assistants like Claude Code or Gemini CLI
- Creating internal note references and linked knowledge bases
- Documenting file structures in notes
- Creating file references in technical documentation
- Quick file path sharing in team communications
Access plugin settings via Settings → Plugin Options → Shell Path Copy:
- Path Wrapping: Choose how paths are wrapped when copied to the clipboard (none, double quotes, single quotes, or backticks)
- Menu Display: Control which path formats appear in both the context menu and command palette:
- Show both Windows and Linux/Mac options (default)
- Show Windows options only
- Show Linux/Mac options only
- Show Absolute Path Option (Desktop only): Toggle whether the absolute path copy option appears in menus
- Show file:// URL option (Desktop only): Toggle whether the file:// URL copy option appears in menus
- Show Obsidian URL Option: Toggle whether the Obsidian URL copy option appears in menus
- Show Markdown Link Option: Toggle whether the markdown link copy option appears in menus
- Markdown Link Format: Choose between wiki-style (
[[filename]]) and standard markdown ([filename](path)) formats - Show Notifications: Toggle success notifications on/off
This section is for developers who want to modify or extend the plugin for their use. If you want to install and use Shell Path Copy, you can skip this section entirely. The installation instructions above provide everything needed for regular usage.
- Node.js 16+
- npm or yarn
# Clone the repository
git clone https://github.com/ckelsoe/obsidian-shell-path-copy.git
# Navigate to the src directory
cd obsidian-shell-path-copy
# Install dependencies
npm install
# Start development build with auto-reload
npm run dev
# Build for production
npm run build
This plugin uses TypeScript for type checking. Run type checking with:
npm run build
Contributions are welcome! Here's how you can help:
Please open an issue on the GitHub repository for bug reports or feature requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please open an issue first to discuss significant changes.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the need for better file path handling when working with AI coding assistants
- Built for Obsidian using the Obsidian API
- A special thank you to the Obsidian developers for creating such a powerful and extensible product. This plugin would not be possible without their incredible work.
- Thanks to the Obsidian community for their support and feedback
If you find this plugin helpful, consider:
- ⭐ Starring the repository on GitHub
- Reporting bugs or suggesting features via GitHub Issues