The Software Herald
  • Home
No Result
View All Result
  • AI
  • CRM
  • Marketing
  • Security
  • Tutorials
  • Productivity
    • Accounting
    • Automation
    • Communication
  • Web
    • Design
    • Web Hosting
    • WordPress
  • Dev
The Software Herald
  • Home
No Result
View All Result
The Software Herald

tmux Primer: Four Commands to Keep Claude Code Agents Running

Don Emmerson by Don Emmerson
April 12, 2026
in Dev
A A
tmux Primer: Four Commands to Keep Claude Code Agents Running
Share on FacebookShare on Twitter

tmux: Keep remote terminals and AI agents running when your SSH connection drops

tmux keeps remote terminal sessions alive so AI agents and long-running tasks survive SSH disconnects, letting you detach, reattach, and monitor work remotely.

Why tmux matters for AI agents and long-running work

Related Post

Studio Code Beta: WordPress CLI to Build and Validate Block Sites

Studio Code Beta: WordPress CLI to Build and Validate Block Sites

April 27, 2026
Profiling Spring Boot with Micrometer and Actuator to Find Bottlenecks

Profiling Spring Boot with Micrometer and Actuator to Find Bottlenecks

April 23, 2026
Vite + React + TypeScript: CI with GitHub Actions and SonarQube

Vite + React + TypeScript: CI with GitHub Actions and SonarQube

April 23, 2026
Python Validation: Early Return and Rules-as-Data Pattern

Python Validation: Early Return and Rules-as-Data Pattern

April 18, 2026

If you’ve ever started a time-consuming job on a remote machine — a refactor, a test suite, a dependency audit or an AI agent run — and then lost the SSH connection, you know the frustration: the process, the terminal output, and the session state disappear the moment your laptop sleeps or your Wi‑Fi blips. tmux changes that dynamic by running on the remote host and preserving the terminal session independent of your client connection. That means an agent such as Claude Code can continue working on the server even after you close your laptop, and you can reconnect later from another device and pick up exactly where it left off.

The practical benefit is simple and immediate: you can kick off long-running tasks from a workstation, step away (or switch to a mobile device), and monitor or interact with the job later without risking lost progress or context.

What tmux actually does

tmux is a terminal multiplexer that runs on the server or remote Mac you SSH into. When you launch a tmux session, it creates a persistent workspace on that machine. Your SSH client becomes a viewer of that workspace; when your client disconnects, the tmux session and the processes inside it keep running on the server.

A handy analogy: plain SSH is like tuning into a live TV broadcast — leave the room or lose the signal and you miss the show. tmux is recording that broadcast on the remote machine. When you return, you reconnect to the recording and see the exact same screen and scrollback that were running while you were away.

This behavior addresses the single biggest pain point for mobile workflows with AI coding agents: the agent doesn’t rely on your connection to keep working, so you don’t have to babysit long tasks from your laptop.

The three conceptual layers: session, window, pane

Understanding a few tmux concepts makes the tool easier to use:

  • Session — Think of a session as a desk or a workspace. You can have multiple named sessions, for example one for “work” and another for “personal” tasks. A session contains windows and panes and persists on the server.
  • Window — A window is like a browser tab inside a session. Each window hosts a shell and can run a separate task; you switch between windows to move across different tasks.
  • Pane — A pane is a split view inside a window. Use panes when you want multiple shells visible at once (handy on large monitors, less so on phones).

For most mobile-first use cases you only need one session and one or two windows. Panes are convenient at a desktop but can be awkward on small touchscreens.

Install tmux on macOS and Linux

tmux runs on the remote host; you don’t install anything on your phone or tablet. On macOS the source outlines a quick Homebrew-based install:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install tmux
tmux -V

If tmux prints a version such as tmux 3.6a, you’re ready to go.

On Linux, use your distribution package manager: install with sudo apt install tmux on Debian/Ubuntu or sudo dnf install tmux on Fedora/RHEL derivatives.

Create a session

The most basic tmux workflow is to create a named session on the remote host and start work there. The source shows this command example:

tmux new -s work

The name work is arbitrary; pick a name that describes the task or the context. When tmux starts you’ll see a status bar along the bottom of the terminal indicating you’re inside a tmux session.

Detach: leave the session running

Once tmux is running, you can safely step away from your SSH client and the session will keep executing on the server. The standard way to detach is a two‑keystroke sequence known as the prefix key followed by the action key:

Ctrl+b then release then press d

Ctrl+b is tmux’s prefix key — press it, release it, then press d to detach. After detaching you return to the normal shell prompt on your local machine while the tmux session continues on the server. Any running processes, terminal scrollback, and program state remain intact.

Re‑attach later from any device

To return to a running session and resume the same terminal context, attach to the named session:

tmux attach -t work

You’ll come back to the same screen, including any output produced while you were disconnected. If an AI agent finished a long task in your absence, you’ll see its output waiting; if it’s still working you’ll see live progress.

The one command many users prefer

The article highlights a single idempotent command that combines create and attach behavior:

tmux new -As work

The -A flag makes tmux attach to an existing session named work if it exists; if it doesn’t, tmux creates it. That one-liner always puts you into the same session name without needing to remember whether it already exists.

A compact daily workflow with an AI agent

A practical, device‑agnostic pattern shown in the source uses tmux to host an AI agent like Claude Code on the server:

Morning, on a desktop:
ssh me@myserver
tmux new -As work
claude

Start the agent inside the named session and ask it to perform a long-running task: rework code, generate tests, or audit dependencies. Detach and close your laptop; the server-side session keeps running.

Later, from a phone or tablet:
ssh me@myserver
tmux attach -t work

You’ll see exactly the same terminal context the agent was using. If the agent is waiting for input you can reply immediately; if it’s still processing you can watch progress and detach again once you need to switch contexts. The same session can be reattached on your desktop in the evening with tmux attach -t work, preserving continuity across devices.

This pattern — start a long-running agent task on one device, monitor and approve from another — is the workflow that makes server-side agents practical on mobile.

A small gotcha when switching devices and how to fix it

If you attach to the same tmux session from a phone while the session is still attached to your Mac, tmux will resize the display to match the smaller screen, which can be disruptive. The fix shown in the source is to force-detach any existing attachments when you attach from the new device:

tmux attach -d -t work

The -d flag detaches whoever was previously attached so only your current device sees the session. That prevents unwanted window resizing when bouncing between Mac and iPad.

Common keys for regular use

After you’re comfortable with the basics, a few extra key sequences help navigation. All tmux key commands start with the prefix Ctrl+b, then a second key:

  • Detach: Ctrl+b then d
  • List sessions: Ctrl+b then s
  • New window: Ctrl+b then c
  • Next window: Ctrl+b then n
  • List windows: Ctrl+b then w
  • Help: Ctrl+b then ?

On a touchscreen device, the prefix model can be clumsy because finding and tapping Ctrl then b then the action key slows you down; for phone work it’s often enough to use windows rather than panes — two windows, one for the agent and one for quick git checks or file edits, covers most needs.

Where tmux’s control model can be painful on mobile — and an available workaround

tmux’s prefix-key approach is ergonomically tuned for physical keyboards but can be awkward on soft keyboards: tapping Ctrl then b then n every time to switch windows quickly becomes tedious. The source describes a mobile-focused alternative the author built: MT — Mosh Terminal, a one-time iOS app available on the App Store for $14.99. According to the source, MT places one-tap tmux operations on a persistent bottom action bar (split, switch, detach, etc.) so the prefix-key gymnastics disappear on mobile. The app also issues a system push notification when an agent like Claude Code requires user input, letting you stop polling the session manually.

You don’t need that app to use tmux effectively, but it’s presented as a convenience option if you frequently manage tmux sessions from phones or small tablets.

A concise cheat sheet

For quick reference, the source lists the essential commands and actions that will get you started and secure your work across devices:

  • Start or rejoin: tmux new -As work
  • Step out (detach): Ctrl+b then d
  • Come back (attach): tmux attach -t work
  • Steal session from another device: tmux attach -d -t work

Try this once: start a tmux session on your dev host, run a long task inside it, close your laptop, and reconnect from your phone an hour later — the session, output, and process state will be exactly as you left them.

Implications for developers, teams, and organizations

The practical simplicity of tmux has several implications across developer workflows and team practices:

  • Mobile-first monitoring and approval: With tmux, developers can initiate compute‑heavy or interactive agent tasks on a stable remote host and switch to a mobile device to inspect results or respond when needed, reducing the need for continuous laptop tethering.
  • Resilience to flaky connections: Because the session state persists server-side, transient network outages or sleeping laptops no longer cause lost work, which reduces friction for remote or distributed teams working over unstable networks.
  • Lightweight session management vs. heavyweight orchestration: tmux provides a minimal, human-centric way to preserve terminal context for interactive tasks. It’s complementary to automation and orchestration tools rather than a replacement—use tmux when you need an interactive, persistent terminal workspace that survives client disconnects.
  • Developer tooling integration: tmux sits alongside tools teams already use — shells, SSH, AI agents, git workflows, and CI systems — and can make it easier to move between local development and server-based work without changing the underlying tooling dramatically.

For individual developers and small teams, tmux offers an immediate productivity win: fewer interrupted sessions, preserved context, and a simple way to manage interactive workloads across devices.

When to reach for tmux and when it’s less useful

tmux shines for interactive or long-running tasks you want to supervise manually: live refactors, exploratory test runs, code-gen agents, remote debugging sessions, and anything where you need the terminal’s scrollback preserved. It’s less relevant where fully automated, headless jobs already run under a process manager, CI system, or orchestration platform that handles restarts and logging at scale.

Final forward-looking paragraph

As remote development and AI-assisted coding workflows continue to expand, tools that preserve context and reduce friction between devices will remain valuable. tmux’s simple model — persistent sessions, rapid attach/detach, and minimal configuration — keeps it a practical building block for developers who want resilient, mobile-friendly ways to run and manage agents and long tasks on remote machines; paired with mobile tooling that streamlines prefix-key interactions and notifications, it can help make server-hosted AI workflows as seamless to monitor from a phone as they are from a workstation.

Tags: AgentsClaudeCodeCommandsPrimerRunningtmux
Don Emmerson

Don Emmerson

Related Posts

Studio Code Beta: WordPress CLI to Build and Validate Block Sites
Dev

Studio Code Beta: WordPress CLI to Build and Validate Block Sites

by Jeremy Blunt
April 27, 2026
Profiling Spring Boot with Micrometer and Actuator to Find Bottlenecks
Dev

Profiling Spring Boot with Micrometer and Actuator to Find Bottlenecks

by Don Emmerson
April 23, 2026
Vite + React + TypeScript: CI with GitHub Actions and SonarQube
Dev

Vite + React + TypeScript: CI with GitHub Actions and SonarQube

by Don Emmerson
April 23, 2026
Next Post
HttpModel in LuciferCore: SIMD, Zero-Allocation HTTP vs Binary Protocols

HttpModel in LuciferCore: SIMD, Zero-Allocation HTTP vs Binary Protocols

Microsoft 365 Price Hike July 1: Business Plans +$1–$3, Gov’t +5–13%

Microsoft 365 Price Hike July 1: Business Plans +$1–$3, Gov't +5–13%

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Rankaster.com
  • Trending
  • Comments
  • Latest
NYT Strands Answers for March 9, 2026: ENDEARMENTS Spangram & Hints

NYT Strands Answers for March 9, 2026: ENDEARMENTS Spangram & Hints

March 9, 2026
JavaScript Execution Context Explained: Hoisting, Call Stack & Phases

JavaScript Execution Context Explained: Hoisting, Call Stack & Phases

April 6, 2026
PubMed API Guide: Use E-utilities to Search 35M Biomedical Papers

PubMed API Guide: Use E-utilities to Search 35M Biomedical Papers

March 25, 2026
Android 2026: 10 Trends That Will Define Your Smartphone Experience

Android 2026: 10 Trends That Will Define Your Smartphone Experience

March 12, 2026
Minecraft Server Hosting: Best Providers, Ratings and Pricing

Minecraft Server Hosting: Best Providers, Ratings and Pricing

0
VPS Hosting: How to Choose vCPUs, RAM, Storage, OS, Uptime & Support

VPS Hosting: How to Choose vCPUs, RAM, Storage, OS, Uptime & Support

0
NYT Strands Answers for March 9, 2026: ENDEARMENTS Spangram & Hints

NYT Strands Answers for March 9, 2026: ENDEARMENTS Spangram & Hints

0
NYT Connections Answers (March 9, 2026): Hints and Bot Analysis

NYT Connections Answers (March 9, 2026): Hints and Bot Analysis

0
23andMe Sued by California AG Over 2023 Breach Exposing Nearly 7M Genetic Records

23andMe Sued by California AG Over 2023 Breach Exposing Nearly 7M Genetic Records

May 29, 2026
Anodot Breach Exposes Rockstar Snowflake Data, ShinyHunters Threaten Leak

Anodot Breach Exposes Rockstar Snowflake Data, ShinyHunters Threaten Leak

May 17, 2026
Canvas Hack: House Demands Instructure Testimony Over Ransom Deal

Canvas Hack: House Demands Instructure Testimony Over Ransom Deal

May 13, 2026
Online Safety Act: Study Reveals How UK Kids Bypass Age Verification

Online Safety Act: Study Reveals How UK Kids Bypass Age Verification

May 4, 2026

About

Software Herald, Software News, Reviews, and Insights That Matter.

Categories

  • AI
  • CRM
  • Design
  • Dev
  • Marketing
  • Productivity
  • Security
  • Tutorials
  • Web Hosting
  • Wordpress

Tags

Agent Agents API App Apple Apps Architecture Automation AWS build Building Cases Claude CLI Code Coding Data Development Email Enterprise Explained Features Gemini Google Guide Live LLM Local MCP Microsoft Nvidia Plans Power Practical Pricing Production Python Review Security StepbyStep Studio Tools Windows WordPress Workflows

Recent Post

  • 23andMe Sued by California AG Over 2023 Breach Exposing Nearly 7M Genetic Records
  • Anodot Breach Exposes Rockstar Snowflake Data, ShinyHunters Threaten Leak

The Software Herald © 2026 All rights reserved.

No Result
View All Result
  • AI
  • CRM
  • Marketing
  • Security
  • Tutorials
  • Productivity
    • Accounting
    • Automation
    • Communication
  • Web
    • Design
    • Web Hosting
    • WordPress
  • Dev

The Software Herald © 2026 All rights reserved.