A plugin that connects Obsidian to Termux via a local HTTP bridge, bypassing Android Intent restrictions. It allows you to run shell commands on your Android device directly from Obsidian.
- Reliable: Uses standard TCP/IP networking (localhost) for robust communication.
- Silent: Runs in the background without opening Termux windows.
- Bi-directional: Sends commands and retrieves output immediately.
- Secure: Uses a generated security token to prevent unauthorized access.
- Convenient: Includes automated scripts for easy setup and removal.
-
Implement local HTTP bridge -
Add security token authentication -
Support for live terminal - Add live editor for files (nano, vim)
- Customizable command templates (e.g., "git commit -m '...'")
- Visual indicator in status bar for server connection status
-
Run code from snippets (at least .sh ones)
Open Termux and run the following command to automatically set up the environment, download the server, and generate a security token. You can also copy this command directly from the Obsidian plugin settings.
curl -sL https://raw.githubusercontent.com/abduznik/obsidian-shell-termux/main/scripts/install.sh | bash
What this script does:
- Installs Python and OpenSSL if not present.
- Downloads the
obsidian_server.pybridge script. - Generates a secure authentication token.
- Configures
~/.bashrcto auto-start the server when you open Termux.
After the script finishes: It will display a Security Token. Copy this token; you will need to paste it into the Obsidian plugin settings.
- Open Obsidian Settings > Termux Bridge.
- Server Port: Default is
8085. Ensure this matches the port in the python script if you changed it. - Security Token: Paste the token generated by the install script (you can find it in
~/.obsidian_termux_tokenif you lost it). - Click Test Connection to verify everything is working.
- Run Termux Command: Opens a modal to enter a shell command. The output will be displayed in a notification.
- Run Termux Command and Paste Output: Opens a modal to enter a command. The output will be inserted into your current note at the cursor position.
Open the "Termux Terminal" view from the ribbon or command palette.
- Interactive Shell: Type commands and get results.
- Restart Server: Click the refresh icon to restart the server process if it behaves unexpectedly.
- Safety Checks:
- Interactive commands (
nano,vim,top, etc.) are blocked to prevent freezing. pkg installcommands require the-yflag (e.g.,pkg install git -y).
- Interactive commands (
ls -la: List files in your Termux home directory.git status: Check the status of a git repository (if you are in the correct directory).python --version: Check the installed Python version.
To remove the server script and stop the background process, run the following command in Termux (also available in plugin settings):
curl -sL https://raw.githubusercontent.com/abduznik/obsidian-shell-termux/main/scripts/uninstall.sh | bash- Connection Failed: Ensure Termux is running in the background. If you force-stopped Termux, open it again to restart the server.
- Port Conflict: If port 8085 is in use, you can edit
~/bin/obsidian_server.pyto change the port, and update the Obsidian plugin settings to match.