How to Use tmux: The Beginner's Guide (First Session, Panes, Windows, and the Session That Survives a Dropped SSH Connection)
CodexFuse Team · 2026-10-30T11:02:43.639Z · 12 min read
How to use tmux for the first time: install it, start a named session, split panes, manage windows, and detach so your work survives a dropped SSH connection.
Learning how to use tmux is the moment your terminal stops being a pile of disposable windows and starts being a workspace you can leave and come back to. tmux is a terminal multiplexer: one small program that runs many terminal sessions inside a single window, splits that window into panes, and keeps every session alive even after you disconnect. If your server connection starts in PuTTY on Windows, work through the PuTTY beginner guide first — everything below runs inside that connection. By the end of this guide you will install tmux, start your first named session, split panes, manage windows, detach from a session, and reattach to it later — including after your SSH connection drops.
That last part is why server administrators learn tmux. A long deployment, a database migration, or a big file transfer dies when your SSH connection dies — unless it runs inside tmux. This guide gives you the complete beginner workflow: the session/window/pane model, the prefix key, the essential keybindings, a minimal starter config, and the habits that keep your work safe.
What is tmux, exactly?
tmux is a terminal multiplexer — software that lets you run many terminal sessions inside one terminal window and keep those sessions running on the machine after you disconnect. (LinuxBlog.io)
Everything in tmux is built from three concepts. A session is the outermost container: it lives on the machine and keeps running when you detach. A window works like a browser tab — one session can hold many windows. A pane is a split inside a window; you can split a window side-by-side or stacked as many times as you like. (LinuxBlog.io)
You always know you are inside tmux because a status bar sits along the bottom of the terminal — green by default — showing the session name, window list, date, and hostname. (LinuxBlog.io, Skynats)
How to use tmux: the first-time workflow
Using tmux for the first time takes about five minutes and seven steps. Run them in order; each step builds on the last.
- Install tmux from your distribution's repository (
sudo apt install tmuxon Ubuntu/Debian). - Start a named session:
tmux new -s work. Name every session — hunting through numbered sessions later is miserable. - Press the prefix: hold
Ctrland pressb, release both, then press a command key. That two-part keystroke is how tmux tells your typing apart from its commands. - Split the window: prefix then
%for side-by-side panes, prefix then"for stacked panes. - Open a second window: prefix then
c. Move between windows with prefix thennandp. - Detach: prefix then
d. Your shell returns to normal, and everything you started keeps running. - Reattach:
tmux attach -t work— you are exactly where you left off.
How do you install tmux?
tmux ships in the default package repositories of every major Linux distribution, so installation is one command with your distro's package manager. (Skynats, LinuxBlog.io)
| Distribution | Install command |
|---|---|
| Ubuntu / Debian | sudo apt install tmux |
| Fedora / RHEL / CentOS | sudo dnf install tmux |
| Arch / Manjaro | sudo pacman -S tmux |
| openSUSE | sudo zypper i tmux |
After installing, check the version with tmux -V. Aim for 3.0 or newer — most current distributions ship 3.2 or later, and some config options covered below need it. (LinuxBlog.io)
What is the tmux prefix key, and how do you use it?
The prefix key is the two-part keystroke that tells tmux "the next key I press is a command, not something to type into the shell." By default the prefix is Ctrl+b: press and hold Ctrl, tap b, release both, then press the command key. (LinuxBlog.io)
The mistake beginners make is pressing everything at once, like a chord. tmux expects two distinct presses: Ctrl+b, then c — not Ctrl+b+c together. Say it out loud the first few times: "prefix, then the letter." Once the rhythm lands, the keybindings feel instant.
tmux runs inside any terminal app, so the prefix works the same whether you are in a plain Linux terminal, an SSH window, or a smarter terminal like Warp — the Warp beginner guide covers that app if you want blocks and AI features around your tmux sessions.
How do you start, detach, and reattach tmux sessions?
Sessions are the heart of tmux: they are the unit that survives a dropped connection, so learn to name, list, and reattach them before anything else.
| Task | Command |
|---|---|
| Start a named session | tmux new -s work |
| Detach (session keeps running) | prefix, then d |
| List running sessions | tmux ls |
| Reattach a session | tmux attach -t work |
| Reattach the most recent session | tmux a |
| Rename the current session | prefix, then $ |
| Kill a session | tmux kill-session -t work |
Name every session from the start. tmux new alone works, but a list of sessions named 0, 1, and 2 tells you nothing when you come back next week — one word like deploy or work saves you every time. (LinuxBlog.io, Skynats)
The one-project-one-session habit is what makes this scale: one session per project, with that project's windows and panes inside it. Switching projects becomes reattaching a different named session instead of hunting through terminal tabs. (LinuxBlog.io)
How do you split panes and switch windows in tmux?
Panes and windows are how tmux turns one terminal into a full workspace. Panes split a window into visible sections; windows work like browser tabs inside a session. Here is the complete beginner keybinding set — everything below starts with the prefix. (LinuxBlog.io, Skynats)
| Keybinding | What it does |
|---|---|
prefix, then % | Split into side-by-side panes |
prefix, then " | Split into stacked panes |
| prefix, then arrow key | Move between panes |
prefix, then z | Zoom the current pane to full screen (press again to unzoom) |
prefix, then x | Close the current pane |
prefix, then space | Cycle through automatic pane layouts |
prefix, then c | Open a new window |
prefix, then , | Rename the current window |
prefix, then n / p | Next / previous window |
prefix, then 0–9 | Jump straight to a window by number |
prefix, then w | List all windows and pick one |
prefix, then & | Kill the current window (asks for confirmation) |
prefix, then [ | Enter copy mode (scroll with arrows or Page Up/Down, q to exit) |
prefix, then s | List sessions and switch between them |
Two of these deserve a callout. The zoom key (z) temporarily fills the window with one pane when its output is too small to read, then restores the layout when you press it again. Copy mode ([) is how you scroll back through output — the mouse wheel does not scroll in tmux by default — and inside it you can search with /, select with Space, copy with Enter, and paste with prefix then ]. (LinuxBlog.io)
What should your first ~/.tmux.conf contain?
Your first config file should be small: five lines that turn on mouse support, number windows from 1, renumber closed windows, and grow the scrollback buffer. Save this as ~/.tmux.conf — and leave plugins for later; you get most of tmux's value with a clean config, and you should know what you actually need before adding a plugin manager. (LinuxBlog.io)
# Enable mouse support: click panes, drag borders, scroll with the wheel
set -g mouse on
# Number windows and panes from 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1
# Keep window numbers tidy when you close one
set -g renumber-windows on
# Remember more scrollback
set -g history-limit 10000
Apply it without restarting tmux: tmux source-file ~/.tmux.conf. A config file is just text, so it belongs in version control like everything else — the Git beginner guide walks through your first commit if you have not set that up yet. (LinuxBlog.io)
How do you survive a dropped SSH connection with tmux?
Run your long task inside a named tmux session, and a dropped connection stops being a disaster: the session lives on the server, your process keeps running, and you reattach exactly where you left off. (LinuxBlog.io)
The workflow looks like this. SSH into the server and start a session with a name: tmux new -s deploy. Run the long task — a deployment, a database migration, a big rsync transfer. Detach any time with prefix then d, or just close your laptop. When you come back, reattach with tmux attach -t deploy and the task is still there, still running. (LinuxBlog.io)
This pattern beats the old tricks. nohup keeps a process alive but you lose the interactive terminal; screen works but is the older tool. tmux gives you the running session back, interactive, with your panes and layout intact. (LinuxBlog.io)
If you are building a home lab server to practice on, the Proxmox beginner guide walks through your first virtual machines — those VMs are perfect tmux practice ground, since the session survives on the VM even when your SSH client drops.
Developers who live in an editor can get the same safety inside VS Code: run your tmux sessions from its integrated terminal and a dropped remote connection still leaves everything running — the VS Code beginner guide shows how the editor side works.
tmux vs screen: which should a beginner learn?
Learn tmux. screen still ships on many servers and still works for basic session persistence, but tmux wins on the things a beginner touches first: cleaner pane splitting, a friendlier config file, scriptable layouts, better copy mode, and active development. Only learn screen if you maintain old scripts that already use it — there is no reason to write new ones for it. (LinuxBlog.io)
| tmux | screen | |
|---|---|---|
| Pane splitting | Built in and clean (% and ") | Possible but awkward |
| Config file | ~/.tmux.conf, readable and scriptable | ~/.screenrc, older syntax |
| Window management | Sessions, windows, and panes | Windows only |
| Development | Actively developed | Mostly in maintenance |
What mistakes do new tmux users make?
Skipping session names. tmux new feels faster than tmux new -s deploy, right up until you have four sessions numbered 0–3 and no idea which is which. Name every session. (LinuxBlog.io)
Nesting tmux inside tmux. SSH from a tmux session into another server that also runs tmux, and your prefix key now goes to the outer session. Press the prefix twice to send it to the inner session. Avoid nesting unless you have a reason. (LinuxBlog.io)
Installing plugins on day one. tmux has a plugin ecosystem (tmux-resurrect, tmux-continuum, tmux-yank), but plain tmux plus a small config covers nearly everything a beginner needs. Use it for a while first; install a plugin only when you can name the problem it solves. (LinuxBlog.io)
Exiting the shell instead of detaching. Typing exit in the last pane of a session kills the session. Prefix then d detaches and leaves everything running. Build the detach habit from day one.
Sources
Every fact and command in this guide was verified against the following sources, read on 2026-10-30:
- Hayden James, "tmux: The Complete Guide to Terminal Multiplexing on Linux," LinuxBlog.io, March 20, 2026 — linuxblog.io/tmux-the-complete-guide-to-terminal-multiplexing-on-linux (sessions/windows/panes model, install commands, version guidance, prefix key, keybinding tables, copy mode, ~/.tmux.conf starter, SSH-survival workflow, tmux vs screen, plugins)
- Skynats, "How to Use tmux: A Beginner's Guide to Linux," October 22, 2026 — skynats.com/blog/how-to-use-tmux (per-distro install commands, status bar, split/window keybindings, detach and reattach commands)
Frequently Asked Questions
Is tmux already installed on my system?
Run tmux -V: if it prints a version (aim for 3.0 or newer), you are ready. If the command is not found, install it from your distribution's default repository — sudo apt install tmux on Ubuntu/Debian, sudo dnf install tmux on Fedora/RHEL, sudo pacman -S tmux on Arch — since every major distro packages it. (LinuxBlog.io, Skynats)
How do I leave tmux without killing my session?
Press prefix (Ctrl+b), release, then d to detach. The session keeps running in the background; reattach later with tmux attach -t name. Typing exit in the last pane instead ends the session — that is the one distinction to learn on day one. (LinuxBlog.io, Skynats)
Can tmux really survive an SSH disconnect?
Yes. tmux sessions live on the machine where tmux runs, not in your SSH connection, so a dropped connection leaves the session and its processes untouched. Reconnect and run tmux attach -t name to pick up exactly where you left off. (LinuxBlog.io, Skynats)
How do I scroll back through output in tmux?
Enter copy mode with prefix then [, scroll with the arrow keys or Page Up/Page Down, search backward with /, and press q to exit. Adding set -g mouse on to your ~/.tmux.conf also enables mouse-wheel scrolling. (LinuxBlog.io)
Should I learn tmux or screen?
Learn tmux: it has cleaner pane splitting, a more readable config file, scriptable layouts, and active development. screen still works and stays on many servers, but it is only worth learning if you maintain scripts that already depend on it. (LinuxBlog.io)