Control your terminal from Telegram. Send keystrokes, read terminal output — all from your phone.
Works on macOS and Linux.
One bot per machine. Each machine needs its own Telegram bot token. Create a separate bot for each machine you want to control (e.g.
@my_macbook_bot,@my_server_bot). Only one teleterm instance can use a given bot token at a time.
curl -fsSL https://raw.githubusercontent.com/warlockee/teleterm/main/setup.sh | bashThe setup script handles everything: clones the repo, installs dependencies, builds the project, walks you through creating a Telegram bot, and starts teleterm. Works on both macOS and Linux.
Or clone manually:
git clone https://github.com/warlockee/teleterm.git
cd teleterm
./setup.shOn macOS, teleterm reads terminal window text via the Accessibility API (AXUIElement), injects keystrokes via CGEvent, and focuses windows using AXUIElement. It works with any terminal app — no Screen Recording permission needed.
On Linux, teleterm uses tmux: tmux list-panes to discover sessions, tmux capture-pane to read content, and tmux send-keys to inject keystrokes. All sessions you want to control must run inside tmux.
In both cases, terminal output is sent as monospace text to Telegram with a refresh button to update on demand.
Each machine needs its own bot. To create one:
- Open Telegram and message @BotFather
- Send
/newbotand follow the prompts - Name it something you'll recognize (e.g. "My Server Terminal")
- Copy the API token
# The setup script saves the token to apikey.txt and creates run.sh
./run.sh
# Or run directly
./teleterm
# Or pass the token directly
./teleterm --apikey YOUR_BOT_TOKEN| Flag | Description |
|---|---|
--apikey <token> |
Telegram bot API token |
--use-weak-security |
Disable Authenticator (owner-only lock still applies) |
--dbfile <path> |
Custom database path (default: ./mybot.sqlite) |
--dangerously-attach-to-any-window |
Show all windows, not just terminals (macOS only) |
Message your bot on Telegram:
| Command | Action |
|---|---|
.list |
List available terminal sessions |
.1 .2 ... |
Connect to a session by number |
.help |
Show help |
.otptimeout <seconds> |
Set TOTP session timeout |
| Any other text | Sent as keystrokes to the connected terminal |
On Linux, teleterm controls tmux sessions. Make sure your work is running inside tmux:
# Start a named session
tmux new -s dev
# Or start detached sessions
tmux new -s server1 -d
tmux new -s server2 -dThen run teleterm separately (outside tmux or in its own tmux window) and use .list to see your sessions.
Prefix your message with an emoji to add a modifier key:
| Emoji | Modifier | Example |
|---|---|---|
❤️ |
Ctrl | ❤️c = Ctrl+C |
💙 |
Alt | 💙x = Alt+X |
💚 |
Cmd | macOS only |
💛 |
ESC | 💛 = send Escape |
🧡 |
Enter | 🧡 = send Enter |
💜 |
Suppress auto-newline | ls -la💜 = no Enter appended |
\n for Enter, \t for Tab, \\ for literal backslash.
| Variable | Default | Description |
|---|---|---|
TELETERM_VISIBLE_LINES |
40 |
Number of terminal lines to include in output. Increase for more context, decrease for shorter messages. |
TELETERM_SPLIT_MESSAGES |
off | When set to 1 or true, long output is split across multiple Telegram messages. When off (default), output is truncated to fit a single message, keeping the most recent lines. |
Terminal output is sent as a single message by default. Each new command or refresh deletes the previous output messages and sends fresh ones, creating a clean "live terminal" view rather than spamming the chat.
If your terminal produces very long output (e.g. build logs) and you want to see all of it, enable splitting:
TELETERM_SPLIT_MESSAGES=1 ./teleterm- Owner lock: The first Telegram user to message the bot becomes the owner. All other users are ignored.
- TOTP: By default, teleterm requires Google Authenticator verification. A QR code is shown on first launch. Use
--use-weak-securityto disable. - One bot = one machine: Don't share a bot token across machines. Each machine should have its own bot.
- Reset: Delete
mybot.sqliteto reset ownership and TOTP.
macOS: Requires Accessibility permission. macOS will prompt on first use, or grant it in System Settings > Privacy & Security > Accessibility.
Linux: No special permissions needed. Just ensure the user running teleterm can access the tmux socket.
macOS: Terminal.app, iTerm2, Ghostty, kitty, Alacritty, Hyper, Warp, WezTerm, Tabby.
Linux: Any terminal running inside tmux.
MIT — see LICENSE.
Based on tgterm by Salvatore Sanfilippo (antirez).
