tmux.conf shell

because default tmux is an insult to your productivity.

You learned tmux. You use sessions. You split panes. You detach and reattach. You feel powerful.

But you’re still pressing Ctrl+b — a key combination that requires you to dislocate your left hand to reach. You’re still splitting panes with " and % — two characters that have absolutely no mnemonic relationship to “horizontal” and “vertical.” You’re still watching tmux number your first window 0 because apparently counting from one was too intuitive.

You’re driving a sports car with the seat all the way back and the mirrors pointed at the sky. Everything works. Nothing is comfortable.

Your .tmux.conf fixes this. It’s a single file that lives at ~/.tmux.conf and transforms default tmux from “functional but hostile” to “actually pleasant.” Every line below is here for a reason. Steal the whole thing or pick the parts you want.

Unless you’re running Windows then wtf none of this applies to you. But hey, come to the dark side, go install WSL2 and you can follow along. We’ll wait. Impatiently.

If you’re lazy like me (all sysadmins are!) then click here for the tmux.conf config.


The prefix: Ctrl+a instead of Ctrl+b

unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

Ctrl+b is the default prefix. It’s also two keys that are physically far apart on the keyboard, requiring you to stretch your pinky to Ctrl and your index finger to b simultaneously. Every. Single. Time. You want to do anything in tmux.

Ctrl+a keeps your hand in one place. Pinky on Ctrl, ring finger on a. It’s the same remap that screen users have been using since the ’80s, because even thirty years ago people knew Ctrl+b was a terrible choice.

The third line (send-prefix) means if you actually need to send a literal Ctrl+a to a program inside tmux (rare, but it happens), you press Ctrl+a twice.


Split panes: | and - instead of " and %

bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

Default tmux uses " for horizontal splits and % for vertical splits. Quick: which one is which? You don’t remember. Nobody remembers. You’ve been guessing every time and getting it wrong half the time.

| splits vertically (it looks like a vertical line dividing the screen). - splits horizontally (it looks like a horizontal line dividing the screen). You will never guess wrong again.

The unbind lines remove the old bindings so you don’t accidentally use them out of muscle memory and confuse yourself.


Alt+arrow to switch panes (no prefix)

bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

Default pane switching: Ctrl+a, let go, then arrow key. That’s three actions to move one pane over.

With this: Alt+Left. One action. No prefix. The -n flag means “no prefix required.” You just hold Alt and press an arrow. You move. That’s it.

This is the single most impactful line in this entire config. You switch panes constantly. Making it one keystroke instead of three changes how you use tmux.


Reload config without restarting

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

You changed your config. Now what? Kill all your sessions and start over? Close tmux and re-open it?

No. Press Ctrl+a then r. Config reloaded. A confirmation message appears at the bottom. Your sessions, windows, and panes are untouched. You changed the settings on a running car without pulling over.

This is the first thing you should add to any .tmux.conf because it makes testing every other change instant.


Mouse mode

set -g mouse on

One line. Now you can:

  • Click on a pane to select it
  • Drag pane borders to resize them
  • Scroll with your mouse wheel
  • Click on windows in the status bar to switch

“But I thought the point was to not use a mouse.” The point is to have options. Sometimes you’re reading logs and you want to scroll up quickly. Sometimes a coworker is looking at your screen and clicking is faster than explaining Ctrl+a then [ then PgUp. Mouse mode doesn’t replace keyboard shortcuts — it supplements them.


Start counting at 1

set -g base-index 1
setw -g pane-base-index 1

Default tmux numbers your first window 0. Look at your keyboard. Where is the 0 key? On the far right. Where is the 1 key? Right next to the prefix key area.

Your first window should be 1. Your first pane should be 1. This is not controversial. This is ergonomics.


Scrollback buffer: 50,000 lines

set -g history-limit 50000

Default scrollback is 2,000 lines. That sounds like a lot until you’re tailing a busy log and realize the error you need scrolled off the top eleven seconds ago.

50,000 lines is enough to scroll back through a meaningful amount of history without eating significant memory. Adjust to taste, but 2,000 is almost always too low.


Auto-renumber windows

set -g renumber-windows on

You have windows 1, 2, 3, 4. You close window 2. Now you have 1, 3, 4. A gap. An ugly, pointless gap that means Ctrl+a then 2 does nothing and you have to remember to skip it.

With renumber-windows on, closing window 2 makes 3 become 2 and 4 become 3. No gaps. Sequential. The way numbers should work.


Don’t let programs rename your windows

set-option -g allow-rename off

You carefully named your window “logs” with Ctrl+a then ,. Then you ran a command and tmux renamed it to “tail” because the running program changed the window title. Your thoughtful naming was overwritten by a program that doesn’t care about your organizational system.

allow-rename off stops this. Your names stick. Programs can keep their opinions to themselves.


Aggressive resize

setw -g aggressive-resize on

If two clients are connected to the same session with different terminal sizes, default tmux resizes all windows to the smallest client. This means if your phone is connected to the same session as your 4K monitor, everything shrinks to phone-size. That’s not useful.

aggressive-resize only constrains the window size when a smaller client is actively looking at that specific window. Other windows stay full size.


Reduce escape delay

set -sg escape-time 10

Default is 500 milliseconds. If you use Vim inside tmux, this delay means pressing Escape to exit insert mode feels sluggish — tmux is waiting half a second to see if the Escape is the start of a longer key sequence.

10 milliseconds is fast enough that tmux catches real sequences but you never notice the delay. Vim users: this one’s for you.


Silence all the bells

set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none

Default tmux loves to tell you things are happening. A background window had output? Bell. A program finished? Bell. Something blinked? Notification in the status bar.

This turns all of that off. You’ll check your windows when you want to. You don’t need tmux nagging you.


Color scheme: red, yellow, black

This is the visual identity. Your status bar should look like it belongs in a terminal, not in a children’s TV show.

Pane borders

set -g pane-border-style 'fg=red'
set -g pane-active-border-style 'fg=yellow'

Inactive pane borders are red. The active pane border is yellow. You always know where you are at a glance.

Status bar

set -g status-position bottom
set -g status-justify left
set -g status-style 'fg=red'

set -g status-left ''
set -g status-right-style 'fg=black bg=yellow'
set -g status-right '%Y-%m-%d %H:%M '

Clean left side (no clutter), date and time on the right in a yellow badge. The status bar itself is red text on your terminal background.

Window tabs

setw -g window-status-current-style 'fg=black bg=red'
setw -g window-status-current-format ' #I #W #F '

setw -g window-status-style 'fg=red bg=black'
setw -g window-status-format ' #I #[fg=white]#W #[fg=yellow]#F '

The active window is a bold red badge with black text — impossible to miss. Inactive windows are more subdued. #I is the window number, #W is the name, #F is flags (like * for current, - for last).

Messages and copy mode

set -g message-style 'fg=yellow bg=red bold'
setw -g mode-style 'fg=black bg=red bold'
setw -g clock-mode-colour yellow

Error messages, prompts, and copy mode all use the same red/yellow theme. Consistent. Visible. Not subtle.


True color support

set -g default-terminal "tmux-256color"
set -as terminal-features ",xterm-256color:RGB"

If you use Vim, Neovim, or any terminal app with custom color schemes, you need this. Without it, tmux downgrades your colors to 256 and your carefully chosen theme looks like it was rendered on a GameBoy.

The second line enables RGB (24-bit) color support. Your terminal needs to support it too (most modern terminals do — iTerm2, Windows Terminal, Alacritty, kitty).


tmux.conf full config

Here’s the whole thing. Copy it to ~/.tmux.conf, start a new tmux session, and never look back.

# remap prefix 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# bind r for source file reload
bind r source-file ~/.tmux.conf \; display-message "Config reloaded"

# enable mouse mode
set -g mouse on

# switch panes with Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# dont rename windows automatically
set-option -g allow-rename off

# Increase scrollback buffer
set -g history-limit 50000

# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1

# renumber windows when one is closed mid-sequence
set -g renumber-windows on

# Aggressive resize for multi-client
setw -g aggressive-resize on

# set escape time
set -sg escape-time 10

# DESIGN TWEAKS

# Set terminal with proper colors
set -g default-terminal "tmux-256color"
set -as terminal-features ",xterm-256color:RGB"

# don't do anything when a 'bell' rings
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none

# clock mode
setw -g clock-mode-colour yellow

# copy mode
setw -g mode-style 'fg=black bg=red bold'

# panes
set -g pane-border-style 'fg=red'
set -g pane-active-border-style 'fg=yellow'

# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'fg=red'

set -g status-left ''
set -g status-left-length 10

set -g status-right-style 'fg=black bg=yellow'
set -g status-right '%Y-%m-%d %H:%M '
set -g status-right-length 50

setw -g window-status-current-style 'fg=black bg=red'
setw -g window-status-current-format ' #I #W #F '

setw -g window-status-style 'fg=red bg=black'
setw -g window-status-format ' #I #[fg=white]#W #[fg=yellow]#F '

setw -g window-status-bell-style 'fg=yellow bg=red bold'

# messages
set -g message-style 'fg=yellow bg=red bold'

To install: copy the block above, paste it into ~/.tmux.conf, and either restart tmux or — if you already added the reload bind — press Ctrl+a then r.

Back to the top, you overachiever.