Linux Commands & Shell Skills
tmux: Sessions That Outlive Your Connection
tmux is the terminal multiplexer that keeps long-running work alive when your SSH connection dies: a detached server process holds your windows and panes, and any later connection (laptop, office network, another city) reattaches to the same live session. The dedicated piece behind our tmux-vs-screen comparison: the habits that turn it from novelty to operational infrastructure.
Key points
- The mental model is server-client: `tmux new -s deploy` creates a named detached session; `Ctrl-b d` detaches; `tmux attach -t deploy` returns anything later from any connection: deployments, log tails, and compilations survive laptops going to sleep mid-job.
- Windows and panes are the working surface: windows are Alt-style task tabs (Ctrl-b c to create, n/p or numbers to switch), panes split a window (Ctrl-b % vertical, " horizontal, arrow keys navigate): one screen, one context — log in a left pane, service restart on the right.
- Configuration earns its keep in ~/.tmux.conf: bigger scrollback (history-limit), mouse mode for scroll/select, a shorter escape-time (vi-style delay kills latency-sensitive key handling) and a visible status bar showing session and window names; the config lives in version control like everything else operational.
- Copy mode is the quiet superpower: Ctrl-b [ drops into scrollback with search (/) and copy selection; combined with prefixes for grep-class it recovers the 'I saw the error three screens ago' moment that plain SSH scrollback loses.
- Team sessions work: shared named sockets (tmux -S /tmp/pair.sock) let two engineers attach to the same live session for pair debugging or handovers; the session persists as long as the socket lives (and therefore also the shared-shell discipline: mention, don't surprise).
- Scripting reality: `tmux new-session -d -s job 'run-script && send-keys...'`-class automation and tmux commands from cron make unattended multi-pane log-watch setups; pair it with log-to-file for anything that must survive beyond a review loop (our linux-commands cat-hub covers where logs belong instead).
Field note
The deploy that took three hours through one laptop battery used tmux to survive the battery dying twice mid-job. Sessions are infrastructure, and the engineer was asleep when the build finished.
Frequently asked questions
tmux vs screen for new setups?
tmux: better splits, scripting vocabulary, living config community. GNU screen: installed where tmux isn't (older rescue images, minimal hosts). Our comparison article covers the tradeoff table: pick tmux where you choose freely, know screen when the host decides for you.
How do I detach without killing my job?
Prefix d (Ctrl-b d) detaches only the client view: the session (jobs, shells) keeps running server-side; killing requires `tmux kill-session` explicitly, so detachment is always safe.
Can two people attach to read the same session?
Yes, shared named-socket sessions or plain `tmux attach -t` to the same session both work; pair-training, handover, and incident command has become a normal ops use case.
What's the minimum config that pays off immediately?
Larger scrollback history, mouse mode on, shorter escape-time, and a status bar showing host + session name: four lines that prevent most 'wait which box am I on' incidents.
How Kinetikatech helps with linux commands & shell skills
Here's the deal: The commands and scripting habits that decide whether an administrator operates a server or fights it: search, transform, transfer, and supervise text and processes with the tools that live in every base install. Hand it to our Linux Server Security and Server Management service and it's covered, assessed properly, implemented cleanly, monitored around the clock.