Files
MajorWiki/03-opensource/dev-tools/tmux.md
MajorLinux 6592eb4fea wiki: audit fixes — broken links, wikilinks, frontmatter, stale content (66 files)
- Fixed 4 broken markdown links (bad relative paths in See Also sections)
- Corrected n8n port binding to 127.0.0.1:5678 (matches actual deployment)
- Updated SnapRAID article with actual majorhome paths (/majorRAID, disk1-3)
- Converted 67 Obsidian wikilinks to relative markdown links or plain text
- Added YAML frontmatter to 35 articles missing it entirely
- Completed frontmatter on 8 articles with missing fields

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:16:29 -04:00

2.3 KiB

title, domain, category, tags, status, created, updated
title domain category tags status created updated
tmux — Persistent Terminal Sessions opensource dev-tools
tmux
terminal
ssh
multiplexer
linux
published 2026-04-02 2026-04-02

tmux — Persistent Terminal Sessions

Problem

SSH sessions die when your connection drops, your laptop closes, or you walk away. Long-running jobs — storage migrations, file scans, downloads — get killed mid-run. You need a way to detach from a session, come back later, and pick up exactly where you left off.

Solution

tmux is a terminal multiplexer. It runs sessions that persist independently of your SSH connection. You can detach, disconnect, reconnect from a different machine, and reattach to find everything still running.

Installation (Fedora)

sudo dnf install tmux

Core Workflow

# Start a named session
tmux new-session -s mysession

# Detach from a session (keeps it running)
Ctrl+b, d

# List running sessions
tmux ls

# Reattach to a session
tmux attach -t mysession

# Kill a session when done
tmux kill-session -t mysession

Start a Background Job Directly

Skip the interactive session entirely — start a job in a new detached session in one command:

tmux new-session -d -s rmlint2 "rmlint /majorstorage// /mnt/usb// /majorRAID 2>&1 | tee /majorRAID/rmlint_scan2.log"

The job runs immediately in the background. Attach later to check progress:

tmux attach -t rmlint2

Capture Output Without Attaching

Read the current state of a session without interrupting it:

tmux capture-pane -t rmlint2 -p

Split Panes

Monitor multiple things in one terminal window:

# Horizontal split (top/bottom)
Ctrl+b, "

# Vertical split (left/right)
Ctrl+b, %

# Switch between panes
Ctrl+b, arrow keys

Real-World Use

On majorhome, all long-running storage operations run inside named tmux sessions so they survive SSH disconnects:

tmux new-session -d -s rmlint2 "rmlint ..."   # dedup scan
tmux new-session -d -s rsync-migrate "rsync ..."  # file migration
tmux ls  # check what's running

tmux vs screen

Both work. tmux has better split-pane support and scripting. screen is simpler and more universally installed. I use both — tmux for new jobs, screen for legacy ones. See the screen article for reference.