--- title: "tmux — Persistent Terminal Sessions" domain: opensource category: dev-tools tags: [tmux, terminal, ssh, multiplexer, linux] status: published created: 2026-04-02 updated: 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) ```bash sudo dnf install tmux ``` ### Core Workflow ```bash # 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: ```bash 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: ```bash tmux attach -t rmlint2 ``` ### Capture Output Without Attaching Read the current state of a session without interrupting it: ```bash tmux capture-pane -t rmlint2 -p ``` ### Split Panes Monitor multiple things in one terminal window: ```bash # 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: ```bash 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](screen.md) article for reference. ---