⚠ before you start reading: this is not a blog you just read and close. open a terminal right now and keep it next to this tab. every section has a small exercise, do it immediately, don't save it for "later." if you just passively read this, you will forget everything in about 3 days. i promise.

What even is tmux

Ok so honestly, before I learned tmux, I was just opening like 4 separate terminal windows and alt-tabbing between them like a maniac. Running a server in one, editing code in another, watching logs in a third. It was genuinely messy.

Tmux solves this. It is a terminal multiplexer, that scary word just means it lets you run multiple terminals inside one single terminal window. And more importantly, it lets you detach from your work and come back to it later, exactly how you left it.

Imagine this: you start a long running process, a model training, a big build, whatever. You close your laptop and go eat. When you open it again, everything is still there, still running. That’s tmux. That’s the whole magic of it.

The real reason to learn tmux is not the split-screen thing. It’s the “my work persists even when I’m not looking at it” thing.

Also once you get comfortable with it, it genuinely starts to feel like a superpower. Your terminal becomes this organized, structured workspace and you stop losing context constantly. I’m not exaggerating.


Installing it

Before anything else, check if it’s already on your machine:

$ tmux -V

If it prints something like tmux 3.3a you’re good. If not:

# Ubuntu / Debian $ sudo apt install tmux

# Arch / Manjaro $ sudo pacman -S tmux

# Fedora $ sudo dnf install tmux

Very lightweight, installs in seconds.

Exercise 01 => launch tmux for the first time

Type this in your terminal and press Enter:

tmux

You should see your terminal looks slightly different, there's a bar at the bottom. That's tmux's status bar. It shows your session name, open windows, and some info.

To get out for now, type exit or press Ctrl + d. We'll explore properly in the next section.


The three-layer mental model

This is the most important thing to understand before touching any shortcuts. Tmux has three layers and everything builds on top of this.

🗂 Session the "project" persists even when you're not looking
🪟 Window like a browser tab, fills the whole screen
Pane a split inside a window, multiple terminals at once

Think of it like this: a session is your whole project (say, “work” or “side-project”). Inside that session you have multiple windows (like tabs, one for your editor, one for running the server, one for git). And inside each window, you can split it into panes if you want two terminals side by side.

You don’t have to use all three. Most of the time you’ll use sessions + panes. But knowing this model makes every shortcut make sense.

The Prefix Key, the gatekeeper

Almost every tmux shortcut starts with something called the Prefix key. It’s tmux’s way of knowing “ok, the next key you press is a command, not text.”

The default prefix is Ctrl + b. But in my config (which I’ll share later), I changed it to Ctrl + a because it’s way more comfortable to press.

In this blog I’ll write Prefix to mean Ctrl + a. If you’re on a fresh tmux without my config yet, use Ctrl + b , everything else is the same.

// tip: the prefix key does nothing visible when you press it. press it, release, then quickly press the next key. it times out after about a second so don't be slow about it.

Sessions, the superpower

Sessions are genuinely the reason to use tmux. The concept is simple: a session keeps running even when you close your terminal or disconnect. You “detach” from it, go do something else, “attach” back later and everything is exactly how you left it.

Starting a session

# start tmux (creates a session with a random number name) $ tmux

# start with a specific name, much better habit $ tmux new -s work $ tmux new -s side-project $ tmux new -s learning

Always name your sessions. “work”, “personal”, “project-name”, anything. It makes attaching back way easier.

The core session actions

Key / CommandWhat it does
Prefix + dDetach, leave the session running, go back to normal terminal
tmux lsList all running sessions (run this outside tmux)
tmux aAttach back to the last session
tmux a -t workAttach to a specific session by name
Prefix + sList and switch between sessions (inside tmux)
Prefix + $Rename the current session
tmux kill-session -t workKill a specific session
tmux kill-serverNuclear option, kills absolutely everything
Exercise 02 => the detach / attach cycle

This is the core skill. Do this now, it takes 2 minutes:

  1. Outside tmux, run: tmux new -s myfirst
  2. You're now inside a session called "myfirst"
  3. Run something in it: echo "hello from tmux"
  4. Now detach: press Prefix + d, you'll drop back to your normal terminal
  5. Check the session is still alive: tmux ls you should see "myfirst" listed
  6. Attach back: tmux a -t myfirst
  7. See? Your terminal is exactly where you left it.
// checkpoint -- sessions
  • I can create a named session
  • I can detach from a session with Prefix + d
  • I can list sessions with tmux ls
  • I can attach back with tmux a -t <name>

Windows, your tabs

Inside a session, you can have multiple windows. Think browser tabs, each one takes up the whole screen and you switch between them. The status bar shows all your open windows.

I use windows when I want to completely separate concerns. Window 1 for editor, window 2 for git, window 3 for running tests. When I’m doing simple stuff, I just stick to panes.

KeyWhat it does
Prefix + cCreate a new window
Prefix + ,Rename the current window
Prefix + nGo to next window
Prefix + pGo to previous window
Prefix + 1..9Jump to window by number, super fast
Prefix + wTree view, see all sessions and windows at once
Prefix + &Kill current window (asks you to confirm)
Exercise 03 => working with windows
  1. Inside tmux, press Prefix + c, a new window opens, you'll see "2" in the status bar
  2. Press Prefix + , and rename it "server", type the name, press Enter
  3. Press Prefix + c again, rename it "editor"
  4. Now press Prefix + 1 to jump to window 1, then Prefix + 2 for window 2, Prefix + 3 for window 3
  5. Press Prefix + w to see a tree view of everything, use arrow keys to navigate, press Enter to jump to one
// gotcha: by default tmux starts windows at index 0. in my config I changed it to start at 1 (set -g base-index 1). that way Prefix+1 jumps to your first window, which is more intuitive. when you set up my config later, this is handled automatically.
// checkpoint, windows
  • I can create windows with Prefix + c
  • I can rename a window with Prefix + ,
  • I can jump between windows by number
  • I know what the tree view looks like

Panes, splitting the screen

Ok this is the visually impressive part. This is what people show off in their dev setup videos. But it’s also genuinely useful, seeing your code and your running server at the same time without switching is really nice once you get used to it.

Splitting

By default, the shortcuts are Prefix + % for vertical split and Prefix + " for horizontal. These are terrible to remember honestly. In my config I changed them to Prefix + v for vertical and Prefix + s for horizontal. v for vertical, s for stacked. Much more intuitive.

For now use the defaults. Once you set up my config it’ll be nicer.

KeyWhat it does
Prefix + %Split vertically (side by side), default
Prefix + "Split horizontally (top/bottom), default
Prefix + vSplit vertically, my config
Prefix + sSplit horizontally, my config
Prefix + arrowsMove between panes
Prefix + qShow pane numbers, tap a number to jump to that pane
Prefix + zZoom, maximize current pane. Press again to undo.
Prefix + xKill current pane

Resizing

Hold Ctrl after the prefix and press arrow keys for fine control. Alt for bigger jumps. Honestly I mostly just use zoom (Prefix + z) when I need to focus, rather than resizing.

Exercise 04 => build your first real three-pane setup

This simulates an actual workflow:

  1. Create a fresh session: tmux new -s myproject
  2. Split vertically: Prefix + % two panes side by side
  3. In the left pane run: echo "this is my editor"
  4. Move to right pane: Prefix + right arrow
  5. Split it horizontally: Prefix + " now you have 3 panes total
  6. In this bottom-right pane run: echo "this is my logs"
  7. Try navigating between all 3 panes with arrow keys
  8. Press Prefix + q and see the numbers appear, immediately tap one to jump there
  9. Press Prefix + z on any pane to zoom in, then again to zoom out
// the trick I use most: Prefix + q then immediately press the pane number. way faster than pressing the arrow key multiple times. once this is in muscle memory, moving around feels instant.
// checkpoint -- panes
  • I can split a window vertically and horizontally
  • I can navigate between panes with arrow keys
  • I know the Prefix + q trick to jump to panes by number
  • I can zoom in/out with Prefix + z

Copy Mode, keyboard warrior stuff

One thing that’s slightly annoying when you first use tmux is that you can’t scroll up with your mouse wheel to see older output. Tmux captures the terminal. Copy mode is the solution, and once you get used to it, it’s actually better than using the mouse.

How it works:

  1. Press Prefix + [ to enter copy mode. You’ll see [0/0] appear in the top right corner.
  2. Now scroll with arrow keys, or Page Up / Page Down.
  3. If you set setw -g mode-keys vi in your config (which I do), you can use j k to scroll line by line and Ctrl+u / Ctrl+d for half-page jumps.
  4. To select text: press Space to start selection, move to end, press Enter to copy.
  5. To paste: Prefix + ]
  6. To exit without copying: press q or Escape
// quick note: I also have set -g mouse on in my config, which means you can use your mouse to scroll in most cases anyway. copy mode becomes more useful for selecting and copying text precisely. both work together fine.
Exercise 05 => scrolling through history
  1. Create a long output in a pane:
    for i in $(seq 1 50); do echo "line $i"; done
  2. Press Prefix + [ to enter copy mode
  3. Use arrow keys to scroll up through the output
  4. Press q to exit copy mode

The Config File

By default tmux is not that comfortable. The prefix key is awkward, you can’t scroll with the mouse, no nice colors. The config file is where you fix all of this.

Where it lives

~/.config/tmux/tmux.conf

Older setups use ~/.tmux.conf. Both work. I use the .config path because it’s cleaner (XDG standard).

Create it

$ mkdir -p ~/.config/tmux $ touch ~/.config/tmux/tmux.conf $ nvim ~/.config/tmux/tmux.conf # or nano, vim, whatever

Reloading without restarting

After editing, tell tmux to read the new config:

tmux source-file ~/.config/tmux/tmux.conf

Or add this shortcut so you can press Prefix + r to reload:

bind r source-file ~/.config/tmux/tmux.conf \; display "Config reloaded!"

Add that line, save, manually source once. After that Prefix + r always reloads for you.


My exact setup, the hacker dashboard

Ok so this is my actual config. I’ll go through each section so you understand what each thing does before copy-pasting. Don’t blindly copy config files you don’t understand, you’ll run into problems and have no idea why.

This config uses TPM (Tmux Plugin Manager) for some plugins. I’ll explain how to install it too.

Step 1 -> Install TPM

$ git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm

That’s it. TPM is just a folder, no system install needed.

Step 2 -> The full config, explained

~/.config/tmux/tmux.conf
# ── MODULE 1: THE CORE ──────────────────────────────────────────

# Change prefix from Ctrl+b (default) to Ctrl+a # Ctrl+a is much more comfortable, left pinky on Ctrl, ring finger on ‘a’ set -g prefix C-a unbind C-b bind C-a send-prefix unbind o

set -g mouse on # scroll with mouse, click to focus panes set -g base-index 1 # windows start at 1, not 0 set -g renumber-windows on # close window 2 → window 3 becomes window 2 set -g detach-on-destroy off # closing a session drops you to another, not to shell set -g set-clipboard on # copies go to system clipboard

# ── MODULE 2: NAVIGATION ──────────────────────────────────────── # vim-tmux-navigator: move between panes with Ctrl+hjkl, no prefix needed # works seamlessly across tmux panes AND neovim splits set -g @plugin ‘christoomey/vim-tmux-navigator’

# v for vertical (side by side), s for stacked (top/bottom) # -c “#{pane_current_path}” means new pane opens in same directory bind v split-window -h -c “#{pane_current_path}" bind s split-window -v -c “#{pane_current_path}"

# ── MODULE 3: THE DESIGN (Hacker Dashboard) ───────────────────── set -g status-position top # status bar at the top (more modern feel) set -g status-interval 3 # refresh the bar every 3 seconds set -g status-justify left

# Dark base for the whole status bar set -g status-style ‘bg=#111111’

# Left side: session name with a small icon set -g status-left ”#[fg=#00ffcc,bg=#1e1e2e,bold] 󰚀 #S #[fg=#1e1e2e,bg=default]" set -g status-left-length 30

# Right side: date and time in green/cyan set -g status-right ”#[fg=#333333]#[fg=#00ff00,bg=#333333] 󰃭 %Y-%m-%d #[fg=#00ffcc]󱑒 %H:%M “

# Active window tab: bold yellow highlight set -g window-status-current-format ”#[fg=#111111,bg=#ffff00,bold] #I:#W “ # Inactive window tabs: dimmed grey set -g window-status-format ”#[fg=#666666,bg=default] #I:#W “

# ── MODULE 4: PERSISTENCE (The Time Machine) ──────────────────── # tmux-resurrect: manually save/restore sessions # Prefix + Ctrl+s to save, Prefix + Ctrl+r to restore set -g @plugin ‘tmux-plugins/tmux-resurrect’ # tmux-continuum: auto-saves every 15 min + auto-restores on tmux start set -g @plugin ‘tmux-plugins/tmux-continuum’ set -g @continuum-restore ‘on’ # If you use neovim: also restore your nvim sessions set -g @resurrect-strategy-nvim ‘session’

# ── MODULE 5: SLEEK SESSION MANAGER ───────────────────────────── # tmux-sessionx: floating fuzzy session picker # Press Prefix + o to open it set -g @plugin ‘omerxx/tmux-sessionx’ set -g @sessionx-bind ‘o’ set -g @sessionx-window-height ‘75%’ set -g @sessionx-window-width ‘75%’

# ── INITIALIZE TPM (always keep this at the very bottom) ──────── set -g @plugin ‘tmux-plugins/tpm’ run ’~/.config/tmux/plugins/tpm/tpm’

Step 3 -> Install the plugins

After saving the config, open tmux (or reload it), then press:

Prefix + I    (capital I, like "Install")

TPM will pull all plugins from GitHub. You’ll see it downloading. When done, press Enter.

// note about the icons: the status bar uses Nerd Font icons (those little symbols like 󰚀). if they show as weird boxes, you need to install a Nerd Font and set it as your terminal font. grab one from nerdfonts.com, I use JetBrainsMono Nerd Font. if you don't want to deal with fonts right now, just delete those icon characters from the status-left and status-right lines and it'll work fine with plain text.

What each plugin actually does

vim-tmux-navigator – lets you press Ctrl + h/j/k/l to move between panes without using the prefix at all. And if you also use Neovim, the same keys cross the vim/tmux boundary seamlessly. You just navigate everywhere with Ctrl+hjkl and never think about it.

tmux-resurrect – saves your entire tmux state (sessions, windows, panes, running commands) to a file. Prefix + Ctrl+s to save, Prefix + Ctrl+r to restore. Super useful after a reboot.

tmux-continuum – same thing but automatic. Saves every 15 minutes, restores on startup. You don’t have to think about it at all.

tmux-sessionx – a beautiful floating fuzzy-finder for sessions. Press Prefix + o and get a popup where you can search and switch sessions, create new ones, even preview them. A nice upgrade from the basic list.

Exercise 06 => full setup from scratch
  1. Clone TPM: git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm
  2. Copy the config above into ~/.config/tmux/tmux.conf
  3. Start a fresh tmux: tmux
  4. Source the config: tmux source-file ~/.config/tmux/tmux.conf
  5. Install plugins: Prefix + I (capital I)
  6. Wait for it to finish, press Enter
  7. Notice the status bar moved to the top and looks different
  8. Try the new split keys: Prefix + v and Prefix + s
  9. Try navigating with Ctrl + h/l, no prefix needed

Building muscle memory

Reading about shortcuts and actually having them in your fingers are two completely different things. The brain learns by doing, not by reading. So here’s my honest recommendation for the first two weeks.

Week 1 => force yourself to use just these four things

Don’t try to learn everything at once. Seriously. Just these four:

  1. Prefix + d -> detach. Use this instead of closing your terminal.
  2. tmux a -> attach back. Build this rhythm: detach → do something → attach.
  3. Prefix + v -> split panes. Every time you want a second terminal, use this instead of opening a new window.
  4. Prefix + q, then number -> jump to a pane. Drill this until it’s automatic.

That’s week 1. If you use just these 4 things consistently, tmux starts feeling normal within a few days.

Week 2 => add these

  1. Prefix + c, Prefix + , -> create and name windows. Start organizing your work this way.
  2. Prefix + number -> jump to windows by number. Muscle memory for this is fast.
  3. Prefix + z -> zoom. Use when you need focus on one pane.
  4. Prefix + [ -> copy mode scrolling. Replace your mouse scrolling habit with this.

The daily workflow drill

Daily ritual, do this every single day for two weeks
  1. tmux new -s <project-name> or attach if it already exists
  2. Rename your first window with Prefix + ,
  3. Split it once with Prefix + v, editor on left, terminal on right
  4. When you're done: Prefix + d to detach, don't close tmux
  5. Next day: tmux a and you're back exactly where you were

Do this exact workflow every day for two weeks. After that, it will feel genuinely weird to not use tmux.

The three commands you should never forget

If you forget everything else, remember these. I call them the survival kit:

# list all running sessions $ tmux ls

# attach to the last one $ tmux a

# when everything is a mess and you want to start fresh $ tmux kill-server

And inside tmux, if you forget any shortcut:

Prefix + ?   →   shows every active shortcut (press q to close)

This is the built-in manual. Any time you forget something, this is faster than googling.


Quick reference cheatsheet

Sessions

tmux new -s <name>new session
tmux lslist sessions
tmux a -t <name>attach
Prefix + ddetach
Prefix + $rename session
Prefix + osessionx picker

Windows

Prefix + cnew window
Prefix + ,rename window
Prefix + n / pnext / prev
Prefix + 1-9jump by number
Prefix + wtree view
Prefix + &kill window

Panes

Prefix + vsplit vertical
Prefix + ssplit horizontal
Ctrl + h/j/k/lnavigate (plugin)
Prefix + q, Njump to pane N
Prefix + zzoom / unzoom
Prefix + xkill pane

Copy / Misc

Prefix + [enter copy mode
q / Escexit copy mode
Space → Enterselect + copy
Prefix + ]paste
Prefix + ?show all shortcuts
Prefix + rreload config

A few months ago I was alt-tabbing between 4 terminal windows like an idiot. Now I have one tmux session per project, everything is organized, and I can pick up exactly where I left off after a reboot because of the continuum plugin. The learning curve is real, first few days it’ll feel annoying and slow. Push through that. It clicks, and then it feels obvious that this is just how terminals should work.

Good luck. And remember, the point is not to memorize shortcuts, it’s to build habits. Habits come from doing things repeatedly, not from reading about them once.