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:
If it prints something like tmux 3.3a you’re good. If not:
# Arch / Manjaro $ sudo pacman -S tmux
# Fedora $ sudo dnf install tmux
Very lightweight, installs in seconds.
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.
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.
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 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 / Command | What it does |
|---|---|
| Prefix + d | Detach, leave the session running, go back to normal terminal |
| tmux ls | List all running sessions (run this outside tmux) |
| tmux a | Attach back to the last session |
| tmux a -t work | Attach to a specific session by name |
| Prefix + s | List and switch between sessions (inside tmux) |
| Prefix + $ | Rename the current session |
| tmux kill-session -t work | Kill a specific session |
| tmux kill-server | Nuclear option, kills absolutely everything |
This is the core skill. Do this now, it takes 2 minutes:
- Outside tmux, run:
tmux new -s myfirst - You're now inside a session called "myfirst"
- Run something in it:
echo "hello from tmux" - Now detach: press Prefix + d, you'll drop back to your normal terminal
- Check the session is still alive:
tmux lsyou should see "myfirst" listed - Attach back:
tmux a -t myfirst - See? Your terminal is exactly where you left it.
- 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.
| Key | What it does |
|---|---|
| Prefix + c | Create a new window |
| Prefix + , | Rename the current window |
| Prefix + n | Go to next window |
| Prefix + p | Go to previous window |
| Prefix + 1..9 | Jump to window by number, super fast |
| Prefix + w | Tree view, see all sessions and windows at once |
| Prefix + & | Kill current window (asks you to confirm) |
- Inside tmux, press Prefix + c, a new window opens, you'll see "2" in the status bar
- Press Prefix + , and rename it "server", type the name, press Enter
- Press Prefix + c again, rename it "editor"
- Now press Prefix + 1 to jump to window 1, then Prefix + 2 for window 2, Prefix + 3 for window 3
- Press Prefix + w to see a tree view of everything, use arrow keys to navigate, press Enter to jump to one
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.
- 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.
| Key | What it does |
|---|---|
| Prefix + % | Split vertically (side by side), default |
| Prefix + " | Split horizontally (top/bottom), default |
| Prefix + v | Split vertically, my config |
| Prefix + s | Split horizontally, my config |
| Prefix + arrows | Move between panes |
| Prefix + q | Show pane numbers, tap a number to jump to that pane |
| Prefix + z | Zoom, maximize current pane. Press again to undo. |
| Prefix + x | Kill 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.
This simulates an actual workflow:
- Create a fresh session:
tmux new -s myproject - Split vertically: Prefix + % two panes side by side
- In the left pane run:
echo "this is my editor" - Move to right pane: Prefix + right arrow
- Split it horizontally: Prefix + " now you have 3 panes total
- In this bottom-right pane run:
echo "this is my logs" - Try navigating between all 3 panes with arrow keys
- Press Prefix + q and see the numbers appear, immediately tap one to jump there
- Press Prefix + z on any pane to zoom in, then again to zoom out
- 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:
- Press Prefix + [ to enter copy mode. You’ll see
[0/0]appear in the top right corner. - Now scroll with arrow keys, or Page Up / Page Down.
- If you set
setw -g mode-keys viin your config (which I do), you can use j k to scroll line by line and Ctrl+u / Ctrl+d for half-page jumps. - To select text: press Space to start selection, move to end, press Enter to copy.
- To paste: Prefix + ]
- To exit without copying: press q or Escape
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.
- Create a long output in a pane:
for i in $(seq 1 50); do echo "line $i"; done - Press Prefix + [ to enter copy mode
- Use arrow keys to scroll up through the output
- 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
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
That’s it. TPM is just a folder, no system install needed.
Step 2 -> The full config, explained
# 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.
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.
- Clone TPM:
git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm - Copy the config above into
~/.config/tmux/tmux.conf - Start a fresh tmux:
tmux - Source the config:
tmux source-file ~/.config/tmux/tmux.conf - Install plugins: Prefix + I (capital I)
- Wait for it to finish, press Enter
- Notice the status bar moved to the top and looks different
- Try the new split keys: Prefix + v and Prefix + s
- 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:
- Prefix + d -> detach. Use this instead of closing your terminal.
- tmux a -> attach back. Build this rhythm: detach → do something → attach.
- Prefix + v -> split panes. Every time you want a second terminal, use this instead of opening a new window.
- 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
- Prefix + c, Prefix + , -> create and name windows. Start organizing your work this way.
- Prefix + number -> jump to windows by number. Muscle memory for this is fast.
- Prefix + z -> zoom. Use when you need focus on one pane.
- Prefix + [ -> copy mode scrolling. Replace your mouse scrolling habit with this.
The daily workflow drill
tmux new -s <project-name>or attach if it already exists- Rename your first window with Prefix + ,
- Split it once with Prefix + v, editor on left, terminal on right
- When you're done: Prefix + d to detach, don't close tmux
- Next day:
tmux aand 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:
# 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
Windows
Panes
Copy / Misc
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.