Never lose your work when SSH crashes again! 7 persistent tmux sessions with instant Ctrl+F switching - perfect for Claude Code, AI CLI tools, and remote server management.
Working on remote servers with AI CLI tools (Claude Code, GitHub Copilot CLI) or during system updates, and your SSH connection crashes? You lose everything!
- Long-running operations interrupted
- AI-assisted coding sessions lost
- System updates leave you disconnected
- No easy way to return to your exact workspace
Tmux Persistent Console gives you 7 persistent tmux sessions that survive anything:
- β SSH connection drops
- β Network issues during updates
- β Server reboots
- β Long-running AI CLI operations
- β Unstable WiFi connections
- Ctrl+F1-F5: Jump directly to active consoles (1-5)
- Ctrl+F6-F10: Access suspended consoles on demand (6-10)
- Ctrl+F11: Open Manager Menu (interactive terminal manager)
- Ctrl+F12: Show Help Reference (keyboard shortcuts)
- Sessions persist across SSH disconnects
- Survives server reboots (with proper setup)
- Auto-recovery from network issues
- Work continues exactly where you left off
- Safe-exit protection - prevents accidental session termination
Perfect companion for:
- Claude Code remote development sessions
- GitHub Copilot CLI workflows
- Long AI-assisted coding sessions
- Remote server maintenance with AI tools
- Function keys work perfectly in Windows Terminal
- No complex key combinations to remember
- Visual session indicators
- Easy remote access setup
curl -sSL https://raw.githubusercontent.com/zentala/tmux-persistent-console/main/install.sh | bash
# Connect interactively
connect-console
# Or directly to specific console
tmux attach -t console-1
# From remote (SSH)
ssh user@server -t "tmux attach -t console-1"
- Claude Code sessions that survive disconnects
- GitHub Copilot CLI long conversations
- AI-assisted debugging and development
- Remote pair programming with AI
- Server updates and maintenance
- Monitoring multiple services
- Long-running deployment scripts
- Emergency troubleshooting
- Unstable internet connections
- Working across multiple time zones
- Switching between different client servers
- Mobile/travel development
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 |
Key | Console | Status |
---|---|---|
Ctrl+F6 |
Console-6 | Available on demand |
Ctrl+F7 |
Console-7 | Available on demand |
Ctrl+F8 |
Console-8 | Available on demand |
Ctrl+F9 |
Console-9 | Available on demand |
Ctrl+F10 |
Console-10 | Available on demand |
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+H |
π Shortcuts Popup | Quick reference popup |
Ctrl+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 |
# Direct connection to specific console
ssh user@server -t "tmux attach -t console-1"
# Interactive menu connection
ssh user@server -t "/path/to/connect-console"
# Windows Terminal profile
{
"name": "Server Console 1",
"commandline": "ssh user@server -t 'tmux attach -t console-1'",
"icon": "π"
}
# List all sessions
tmux ls
# Kill specific session
tmux kill-session -t console-1
# Reset all sessions
tmux kill-server && setup-console-sessions
# Create additional sessions
tmux new-session -d -s "project-work"
# Console-1: Main Claude Code session
ssh server -t "tmux attach -t console-1"
# Run: claude-code
# Console-2: File monitoring
ssh server -t "tmux attach -t console-2"
# Run: tail -f logs/app.log
# Console-3: Git operations
ssh server -t "tmux attach -t console-3"
# Ready for git commands
# Switch instantly with Ctrl+F1, Ctrl+F2, Ctrl+F3
# Console-1: Copilot chat sessions
gh copilot explain "complex function"
# Console-2: Testing and execution
npm test
# Console-3: Git and deployment
git status && git push
# All sessions survive if SSH drops!
tmux-persistent-console/
βββ install.sh # One-liner installer
βββ src/
β βββ setup.sh # Creates 7 persistent sessions
β βββ connect.sh # Interactive connection menu
β βββ tmux.conf # Optimized tmux configuration
β βββ uninstall.sh # Clean removal script
βββ docs/
β βββ 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
βββ README.md # This file
- Installs tmux configuration with function key bindings
- Creates 7 persistent sessions (console-1 to console-7)
- Sets up
connect-console
command alias - Configures optimal tmux settings for remote work
- Linux/macOS with bash
- tmux 2.0+ (will install if missing)
- SSH access to remote servers
# Clone repository
git clone https://github.com/zentala/tmux-persistent-console.git
cd tmux-persistent-console
# Install
./install.sh
# Or copy files manually to ~/.vps/sessions/
mkdir -p ~/.vps/sessions
cp -r src/* ~/.vps/sessions/
chmod +x ~/.vps/sessions/*.sh
ln -s ~/.vps/sessions/connect.sh /usr/local/bin/connect-console
# Copy systemd service file
mkdir -p ~/.config/systemd/user
cp src/tmux-console.service ~/.config/systemd/user/
# Enable and start service
systemctl --user daemon-reload
systemctl --user enable tmux-console.service
systemctl --user start tmux-console.service
# Enable user lingering (sessions persist after logout)
sudo loginctl enable-linger $USER
# Check status
systemctl --user status tmux-console.service
Problem: Typing exit
in a tmux session kills the shell β destroys the session β you lose everything!
Solution: Safe-exit wrapper that prompts before destroying sessions.
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
Features:
- π‘οΈ Safe by default - Enter/Space detaches without killing
β οΈ Requires confirmation - Must typey
to destroy session- π Educates users - Shows consequences before action
- π Automatic installation - Included in setup
See: SAFE-EXIT.md for complete documentation
# Option 1: Run setup script manually
setup-console-sessions
# or
~/.vps/sessions/src/setup.sh
# Option 2: Setup auto-start with systemd (recommended)
# See "Auto-Start on System Boot" section above
- Check terminal emulator settings
- Verify TERM environment variable:
echo $TERM
- See troubleshooting guide
# You're already in tmux, detach first
Ctrl+b, d
# Then connect to desired session
- Verify SSH key authentication
- Check network connectivity
- See remote access guide
Contributions welcome! Please read our Contributing Guide.
- Additional key bindings
- Integration with other terminal multiplexers
- Docker/container support
- More AI CLI tool integrations
- Windows WSL optimization
MIT License - see LICENSE file for details.
Created out of frustration with losing hours of work when SSH connections crashed during:
- Remote server updates with Claude Code
- Long AI CLI sessions that took time to rebuild context
- System maintenance that couldn't be interrupted
- Collaborative debugging sessions
This tool makes remote server work with AI CLI tools much simpler and safer!
Want to test tmux-persistent-console on a real server? We provide automated testing infrastructure using Oracle Cloud Free Tier!
# 1. Clone repository
git clone https://github.com/zentala/tmux-persistent-console.git
cd tmux-persistent-console
# 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
- Free ARM server (4 cores, 24GB RAM) on Oracle Cloud
- Automated installation and configuration
- Comprehensive test suite with 10+ test scenarios
- Interactive testing menu for manual validation
- One-click deployment/cleanup
See tests/README.md
for detailed testing documentation.
π Test your tmux-persistent-console 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
- F-key bindings and behavior
- Active vs suspended terminals
- Manager Menu (F11) specification
- Help Reference (F12) specification
- Status bar design
- Icons and iconography
For contributors: Please read SPEC.md before making changes.
See also:
docs/naming.md
- Naming conventions (pTTY/ptty/PersistentTTY)docs/ICONS.md
- Icon reference and usageARCHITECTURE.md
- Technical architecture detailsCLAUDE.md
- AI assistant development guidelines
- tmux - Terminal multiplexer
- tmux-sessionx - Session manager with preview
- Claude Code - AI-powered coding assistant
β Star this repo if it saved your work from an SSH crash!
Made with β€οΈ for remote workers, sysadmins, and AI CLI enthusiasts.
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.