Vibe Coding Academy Logo Vibe Coding Academy

Tmux for Claude Code

Keep your AI coding sessions running 24/7 on a VPS — even when your SSH disconnects.

Published February 7, 2026 · 6 min read

If you're running Claude Code on a VPS, you need one tool: tmux. Without it, a dropped SSH connection kills your session — and your AI coding run dies with it.

✅ What tmux solves

Step 1: Install tmux

sudo apt update && sudo apt install -y tmux

Step 2: Start a Named Session

Use a memorable name like claude so you can reattach easily.

tmux new -s claude

Step 3: Run Claude Code Inside tmux

Start Claude Code the same way you normally do:

claude

Step 4: Detach Without Killing It

To leave the session running in the background:

Press Ctrl+b then press d

Step 5: Reattach Later

List sessions and reattach:

tmux ls tmux attach -t claude

✅ Pro Tip

If you only have one session, you can simply run tmux attach without the name.

Essential tmux Commands (Cheat Sheet)

⚠️ Common Mistake

Typing exit inside tmux ends the session completely. If you just want to disconnect, always use Ctrl+b then d.

Optional: Increase Scrollback

If you want to scroll through longer logs, add this to ~/.tmux.conf:

set -g history-limit 20000

Reload tmux config:

tmux source-file ~/.tmux.conf

Want More VPS + AI Coding Guides?

Join Vibe Coding Academy for step-by-step tutorials, real-world fixes, and a community of builders shipping with AI.

Join the Academy

Key Takeaways

Abdul Khan
Written by
Abdul Khan