Skip to main content

A Brutally Simple tmux Intro

tmux lets one terminal become many terminals.

That is the whole pitch. You get:

  • sessions - long-running workspaces you can leave and reattach to later
  • windows - tabs inside a session
  • panes - split terminal areas inside a window

The hard part is not understanding tmux. The hard part is remembering the keys before your muscle memory exists. This setup keeps the config small, adds reasonable defaults, and gives you a searchable command palette so you can use tmux before you have memorized tmux.

Install the basics

Run the starter script (preview it first):

curl -fsSL https://raw.githubusercontent.com/DanielCarmingham/how-to/main/static/templates/tmux-starter.sh | bash

That is the whole setup. The script checks for tmux, git, and Bun, and installs whatever is missing using Homebrew, apt-get, dnf, or pacman, depending on your system. Before it installs anything it prints the exact commands and waits for you to confirm:

tmux-starter: missing: tmux, bun

About to run:
sudo apt-get update
sudo apt-get install -y tmux
curl -fsSL https://bun.sh/install | bash

Proceed? [y/N]

Answer y and it continues. Pass --yes to skip the prompt. If there is no terminal to ask, it prints the commands and stops rather than installing anything unattended.

Then it writes a small starter config and installs the plugins for you.

One thing to remember from all of this: Ctrl-Space opens the command palette.

Now start tmux:

tmux

Your first few minutes

Press Ctrl-Space. A search box opens over your terminal. That is the command palette, and it is how you drive tmux before you have memorized anything.

Work through these in order:

  1. Split the screen. Ctrl-Space, type split, press Enter. You now have two panes. Do it again if you want a third.
  2. Move between them. Ctrl-a, let go, then an arrow key. Ctrl-a is the prefix: a key you tap first to tell tmux that the next key is meant for it and not for whatever is running inside. The palette exists so you rarely need to think about it.
  3. Close a pane. Type exit in it, the same as closing any terminal.
  4. Step away without stopping anything. Ctrl-Space, type detach. You are back in your normal terminal, and everything inside tmux is still running.
  5. Come back. Run tmux attach. Every pane is exactly where you left it.

Those last two are the reason people use tmux. A long build, a dev server, or a session on a remote machine survives you closing the terminal.

Once that clicks, the palette is where you find everything else. Try new window, choose session, or theme. Most results show their keyboard shortcut on the right, because the setup wrote the palette a map of which key does what. So searching for a command now is how you stop needing to search for it later.

The tiny survival kit

These are enough to start:

ActionKeys
Open the command paletteCtrl-Space
New windowCtrl-a then c
Next windowCtrl-a then n
Previous windowCtrl-a then p
Split pane verticallyCtrl-a then "
Split pane horizontallyCtrl-a then %
Move between panesCtrl-a then arrow key
Detach from tmuxCtrl-a then d
Reattach latertmux attach
Reload configCtrl-a then R

When you forget one, press Ctrl-Space and search for the action instead.

Give each project its own session

Once you are juggling more than one thing, name your sessions:

tmux new -s my-project

Then tmux attach -t my-project brings back that one specifically, instead of whichever session you touched last.

That is enough tmux to be useful. Learn the rest when you actually need it.