Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
pTTY — persistent virtual terminal for remote AI coding and Linux management via SSH. Keep alive console sessions of Claude, Codex, Gemini, or Pi coding agents, across SSH drops, WiFi glitches, and laptop sleep. Built on tmux with Ctrl+F1–F10 hotkeys for instant switching between 10 terminal sessions.
Jump to setup instructionsFetched from the repository for this visit.
Your Claude Code, Codex, Gemini CLI, and Aider sessions survive SSH drops, bad WiFi, laptop sleep, and even a full client reboot. SSH back into the server and your tmux sessions are still running: same conversation context, same scrollback, same running processes. Once attached,
Ctrl+F1-Ctrl+F10jumps between 10 always-on consoles like browser tabs;Ctrl+F11opens the manager menu,Ctrl+F12shows the keyboard cheatsheet.

You're SSH'd into a remote server running a long Claude Code session. Your WiFi flakes for 10 seconds. SSH disconnects. You reconnect — and your AI conversation context, your scrollback, your background processes are gone. You rebuild context. It can take 15-20 minutes to rebuild. Then it happens again.
This is the daily reality of remote AI-assisted development:
exit in the wrong terminal destroys the sessionpTTY keeps the process alive on the server while you reconnect. tmux runs as a server process; your AI CLI runs as its child; both keep going even when SSH dies. SSH back into the server (ssh user@host -t "tmux attach -t console-1", or via the connect-console menu, or a pre-configured Windows Terminal / iTerm profile) and you land exactly where you were: same conversation, same scrollback, same running processes. From there, Ctrl+F1-Ctrl+F10 switches between 10 always-on consoles inside tmux, each holding its own session.
exit in the wrong terminal (safe-exit confirmation)kill-server)If you need crash-survivable AI sessions, that's a different product (state replication + cloud sync). pTTY is laser-focused on the 95% case: client-side disconnections.
┌───────────┐ ssh ┌──────────────────────────┐
│ laptop │ ─────────────────▶ │ server │
│ (client) │ ◀───────────────── │ tmux: console-1..10 │
└───────────┘ attach/detach └──────────────────────────┘
Set up the alias that makes this a one-command habit: see Set up a short SSH alias in Quick Start.
exitBuilt for:
Each entry: one sentence on what the tool is, one sentence on how pTTY differs.
.tmux.conf archaeology required.pTTY's unique combination:
console-1…console-10 sessions created by one install commandCtrl+F1–F10 for the 10 consoles (no prefix-key gymnastics, works like browser tabs); Ctrl+F11 for the manager menu; Ctrl+F12 for the cheatsheetexit in the wrong terminal prompts before destroying the sessionpTTY explicitly does not try to survive server reboot — that's a fundamentally different product (state replication, cloud sync). pTTY's contract is "survives SSH disconnect, not server restart."
One-liner (recommended):
curl -sSL https://raw.githubusercontent.com/zentala/pTTY/main/install.sh | bash
This installs the scripts, copies tmux.conf, registers a systemd user service (tmux-console.service), enables loginctl lingering, and creates 10 always-on sessions (console-1...console-10). After a server restart, empty sessions are recreated automatically. See A note on server reboots for what that does and does not mean.
If you'd rather inspect the script before running it:
git clone --depth 1 https://github.com/zentala/pTTY.git
cd pTTY
bash install.sh
After install you can verify everything is wired up:
ptty-doctor
Should print all green; if anything is yellow/red it tells you exactly what's wrong.
This creates 10 sessions (console-1...console-10) and the connect-console helper. Ctrl+F1-Ctrl+F10 switches between those sessions after you are attached to tmux.
Upgrading an existing install:
curl -sSL https://raw.githubusercontent.com/zentala/pTTY/main/install.sh | bash -s -- --update
Update mode skips dependency installs, replaces the installed files with the
pinned release, retires files dropped from the release (moved to a .trash-*
folder inside the install dir, never deleted), and reloads the running tmux
server's config. Running sessions and their processes are untouched. Note:
git pull inside ~/.tmux-persistent-console does NOT update the runtime —
always upgrade through the installer.
Edit ~/.ssh/config on your laptop and add a dedicated alias that drops you straight into tmux. Pick any short hostname you like — for example tmux.example.com, dev, ptty:
Host tmux.example.com
HostName your-server.example.com
User you
RequestTTY yes
RemoteCommand tmux attach -t console-1 || tmux new -s console-1
ServerAliveInterval 30
ServerAliveCountMax 3
What each line does:
HostName / User — the actual server you're SSH'ing toRequestTTY yes + RemoteCommand — bypass the login shell and attach directly to tmuxtmux attach -t console-1 || tmux new -s console-1 — attach if it exists, otherwise create it (idempotent; safe to run after a fresh reboot)ServerAliveInterval 30 / ServerAliveCountMax 3 — keep the TCP connection healthy on flaky WiFi; SSH will give up cleanly after ~90s of true silenceNow from your laptop:
ssh tmux.example.com
...and you're in console-1 on the server. WiFi dies? Run the same command again: same session, same AI conversation, same scrollback. Once attached, Ctrl+F1-Ctrl+F10 jumps between the 10 consoles.
If you want SSH bookmarks for each console, duplicate the block and change the RemoteCommand target:
Host tmux1
HostName your-server.example.com
User you
RequestTTY yes
RemoteCommand tmux attach -t console-1 || tmux new -s console-1
ServerAliveInterval 30
Host tmux2
HostName your-server.example.com
User you
RequestTTY yes
RemoteCommand tmux attach -t console-2 || tmux new -s console-2
ServerAliveInterval 30
Then ssh tmux1, ssh tmux2, etc.
Once the SSH alias works, point your terminal profile's command at it:
"commandline": "ssh tmux.example.com"ssh tmux.example.comssh tmux.example.comIf you don't want to edit ~/.ssh/config, the equivalent one-liner works too:
ssh user@server -t "tmux attach -t console-1 || tmux new -s console-1"
But seriously — set up the alias. It's the difference between ssh tmux.example.com and 60 characters of muscle memory.
| Key | Console | Purpose |
|---|---|---|
Ctrl+F1 | 🤖 Console-1 | Claude Code / AI Development |
Ctrl+F2 | 🎪 Console-2 | GitHub Copilot CLI |
Ctrl+F3 | 💻 Console-3 | General Development |
Ctrl+F4 | 🧪 Console-4 | Testing & QA |
Ctrl+F5 | 📊 Console-5 | Monitoring & Logs |
Ctrl+F6 | Console-6 | Extra workspace |
Ctrl+F7 | Console-7 | Extra workspace |
Ctrl+F8 | Console-8 | Extra workspace |
Ctrl+F9 | Console-9 | Extra workspace |
Ctrl+F10 | Console-10 | Extra workspace |
| Key | Action | Purpose |
|---|---|---|
Ctrl+F11 | Manager Menu | Interactive terminal manager (TUI) |
Ctrl+F12 | Help Reference | Keyboard shortcuts & help |
| Key | Action | Purpose |
|---|---|---|
Ctrl+Left | ⬅️ Previous Session | Navigate backwards |
Ctrl+Right | ➡️ Next Session | Navigate forwards |
Ctrl+B H | 📋 Shortcuts Popup | Quick reference popup |
Ctrl+B R | 🔄 Restart Console | Restart current console (with confirmation) |
Ctrl+Alt+R | 🔄 Reset Terminal | Clear & refresh current terminal |
| Key | Action |
|---|---|
Ctrl+b, s | Visual session list |
Ctrl+b, 1-10 | Switch to console 1-10 |
Ctrl+b, ( | Previous session |
Ctrl+b, ) | Next session |
Ctrl+b, L | Last used session |
The clean DevEx is the ~/.ssh/config alias documented in Quick Start — ssh tmux.example.com and you're in. The long-form equivalents below are for users who haven't set up the alias yet:
# Long-form: SSH with explicit RemoteCommand
ssh you@your-server.example.com -t "tmux attach -t console-1 || tmux new -s console-1"
# Interactive menu (lets you pick a console after connecting)
ssh you@your-server.example.com -t "/path/to/connect-console"
# Windows Terminal profile pointing at the SSH alias
{
"name": "pTTY",
"commandline": "ssh tmux.example.com",
"icon": "📟"
}
# List all sessions
tmux ls
# Kill specific session
tmux kill-session -t console-1
# Reset pTTY console sessions only
for i in {1..10}; do tmux kill-session -t "console-$i" 2>/dev/null || true; done
setup-console-sessions
# Create additional sessions
tmux new-session -d -s "project-work"
One SSH connection, multiple consoles via F-keys: run Claude Code in one
console, tests in another, git in a third — flip between them with
Ctrl+F1-Ctrl+F10, and pick up exactly where you left off after any
disconnect. See docs/ai-cli-workflow.md for the
full Claude Code and GitHub Copilot CLI examples.
pTTY/
├── install.sh # One-liner installer
├── src/
│ ├── setup.sh # Creates 10 persistent sessions
│ ├── connect.sh # Interactive connection menu
│ ├── tmux.conf # Optimized tmux configuration
│ ├── uninstall.sh # Clean removal script
│ ├── safe-exit.sh # Safe-exit alias + Ctrl+D guard
│ ├── mission-control.sh # Manager Menu (F11)
│ ├── help-reference.sh # Help Reference (F12)
│ └── tui/ # Shared TUI building blocks
├── docs/
│ ├── SPEC.md # Product specification
│ ├── ARCHITECTURE.md # Technical architecture
│ ├── NAMING.md # Naming conventions
│ ├── ai-cli-workflow.md # AI CLI integration guide
│ ├── remote-access.md # SSH and remote setup
│ ├── windows-terminal.md # Windows Terminal configuration
│ ├── troubleshooting.md # Common issues and solutions
│ └── specs/ # Sub-system specs (help, manager, status bar, ...)
├── tools/ # Repo maintenance scripts (CI checks, link checker)
├── tests/ # Test suite (local Docker + CI infra)
├── scripts/ # Misc dev scripts (doctor.sh)
├── CHANGELOG.md
├── CONTRIBUTING.md
├── CLAUDE.md # AI assistant development guidelines
├── LICENSE
└── README.md # This file
tmux-console.service (systemd user unit) and enables it via loginctl enable-linger so empty sessions auto-recreate on bootconnect-console command aliastmux 3.2+ is required because pTTY uses popup-based controls for the manager
and help surfaces. Older tmux versions do not support those bindings reliably.
# Clone repository
git clone https://github.com/zentala/pTTY.git
cd pTTY
# Install
./install.sh
# Optional: install without systemd user autostart
./install.sh --no-systemd
# Or copy files manually to ~/.tmux-persistent-console/
mkdir -p ~/.tmux-persistent-console
cp -r src/* ~/.tmux-persistent-console/
chmod +x ~/.tmux-persistent-console/*.sh
ln -s ~/.tmux-persistent-console/connect.sh /usr/local/bin/connect-console
pTTY does not try to survive a server reboot in the sense of preserving session state. When the host restarts, the tmux server dies and every session — along with the AI conversation context in process memory — is gone. If you need crash-survivable AI sessions, that's a different product class (state replication + cloud sync); pTTY is laser-focused on surviving SSH disconnects.
What pTTY does do on boot is auto-recreate empty sessions so tmux attach -t console-1 keeps working after a restart instead of failing with no sessions. install.sh wires this up via tmux-console.service + loginctl enable-linger. Manual equivalent:
mkdir -p ~/.config/systemd/user
cp tmux-console.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now tmux-console.service
sudo loginctl enable-linger $USER # required — without this, the service won't start on boot
# Verify
systemctl --user status tmux-console.service
tmux ls # console-1 .. console-10 (empty, freshly created)
systemctl --user stop tmux-console.service only kills console-1..console-10 —
any other tmux session you created yourself is left running.
Problem: Typing exit in a tmux session kills the shell → destroys the session → you lose everything!
Solution: An exit alias that prompts before destroying the session, plus Ctrl+D coverage.
When you type exit in a tmux session:
⚠️ WARNING: You are in a tmux session!
If you exit this shell, the tmux session will be DESTROYED and you will lose:
• Command history from this session
• Any running processes
• Scrollback buffer
Options:
[Enter/Space] - Detach safely (recommended) - keeps session alive
[d] - Detach safely (same as above)
[y] - YES, kill this session permanently
[n] - Cancel, stay in session
pTTY also guards against Ctrl+D (EOF). Inside a pTTY tmux session, the
first Ctrl+D shows Use "exit" to leave the shell. instead of closing the
terminal; typing exit then goes through the same prompt as above. This
only applies inside tmux sessions — your regular local shell outside pTTY
is unaffected.
Mechanism: a shell exit alias plus the shell's own IGNOREEOF
(bash) / IGNORE_EOF (zsh) setting, scoped to interactive tmux sessions.
Honest limits — this is a guard against accidental exits, not a lock:
\exit, command exit, builtin exit, or an exit from inside a script
or subshell all bypass the alias by design.tmux kill-session (from another terminal, the F11 manager menu, or an
external script), or kill/kill -9 on the shell or tmux server, are
not caught here.See: safe exit specification for complete behavior details.
# Option 1: Run setup script manually
setup-console-sessions
# or
~/.tmux-persistent-console/setup.sh
# Note: pTTY does not try to persist sessions across server reboots.
# After a reboot, run setup-console-sessions again. See "A note on server reboots" above.
echo $TERM# You're already in tmux, detach first
Ctrl+b, d
# Then connect to desired session
_ UnderscoresStatus bar uses Nerd Font glyphs from the Material Design Icons range
(U+F0000+). If they render as _, in order of likelihood:
ssh user@server 'locale'; if LANG=C,
add export LANG=C.UTF-8 LC_ALL=C.UTF-8 to ~/.bashrc and recreate
sessions (for i in {1..10}; do tmux kill-session -t "console-$i" 2>/dev/null || true; done; setup-console-sessions).RemoteCommand bypasses your shell init — bake the locale into
the command itself:
RemoteCommand LANG=C.UTF-8 LC_ALL=C.UTF-8 /usr/bin/tmux -u attach -t console-1Full diagnostic flow: troubleshooting guide.
Contributions welcome! Please read our Contributing Guide.
MIT License - see LICENSE file for details.
Created out of frustration with losing hours of work when SSH connections crashed during:
This tool makes remote server work with AI CLI tools much simpler and safer!
Want to test pTTY on a real server? We provide automated testing infrastructure using Oracle Cloud Free Tier!
# 1. Clone repository
git clone https://github.com/zentala/pTTY.git
cd pTTY
# 2. Setup Oracle Cloud credentials
cp tests/terraform/terraform.tfvars.example tests/terraform/terraform.tfvars
# Edit with your Oracle Cloud details
# 3. Deploy test server (FREE!)
cd tests/scripts
./deploy.sh
# 4. Run comprehensive tests
./test-remote.sh
# 5. Interactive testing
./interactive-test.sh
# 6. Cleanup when done
./destroy.sh
See tests/README.md for detailed testing documentation.
🎉 Test your pTTY setup risk-free on real cloud infrastructure!
This project follows spec-driven development. All features and behavior are documented in:
SPEC.md - Complete unified specification
For contributors: Please read SPEC.md before making changes.
See also:
docs/NAMING.md - Naming conventions (pTTY/ptty/PersistentTTY)docs/ICONS-NETWORK-SET.md - Icon reference and usagedocs/ARCHITECTURE.md - Technical architecture detailsCLAUDE.md - AI assistant development guidelinesIf pTTY saved your session, a star helps others find it.
Note from the author: This tool was born from my personal frustration with losing SSH sessions during unstable WiFi, laptop sleep, or moving between locations. I wanted something that "just works" without complex configuration. I'm not a tmux expert, but I value good developer experience (DevEx). If you find bugs or have ideas, contributions are welcome! We use conventional commits and encourage working with Claude Code via CLAUDE.md.
GitHub checked 207h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.