🖥️ Getting Started with tmux: Terminal Multiplexing Made Easy

Boost your terminal productivity with tmux, the ultimate tool for managing multiple sessions, panes, and windows—all from a single command-line interface.

If you’ve ever wished you could have multiple terminal sessions inside a single window — split screens, background processes, and persistent sessions — then you’re going to love tmux.

This guide walks you through:

  • Installing tmux
  • Alternatives you can consider
  • How to start using it
  • Essential commands and keybindings

🔧 What Is tmux?

tmux (Terminal Multiplexer) lets you manage multiple terminal sessions from a single window. You can split panes, switch between windows, keep sessions running after disconnecting (great for SSH), and automate workflows.


✅ Installing tmux

On Debian/Ubuntu:

sudo apt update
sudo apt install tmux

On Fedora:

sudo dnf install tmux

On macOS (with Homebrew):

brew install tmux

On Arch:

sudo pacman -S tmux

🔁 Popular Alternatives to tmux

ToolDescription
screenThe OG terminal multiplexer. Older, still works well, but lacks modern features.
zellijRust-based alternative with a modern UI and configuration. Great for beginners.
byobuA more user-friendly wrapper around tmux or screen. Adds status bars and menu options.
weztermGPU-accelerated terminal emulator with built-in multiplexing (still maturing).
tilixGUI-based terminal with tiling support — more for desktop users.

💡 For raw power and remote use, tmux remains the go-to.


🚀 Running tmux

Start a session:

tmux

Start a named session:

tmux new -s mysession

Attach to a session:

tmux attach -t mysession

List sessions:

tmux ls

Detach from a session:

Ctrl + B, then D

Kill a session:

tmux kill-session -t mysession

🎹 Essential tmux Shortcuts

All keybindings start with Ctrl + B (the prefix).

tmux works like this:

  1. Press and release Ctrl + B → this is the prefix.
  2. Then press C (don’t hold all together like a chord).

So:

🔁 Ctrl + B, release both, then press C

If you’re doing it all at once (like Ctrl + B + C), it won’t work.

ShortcutAction
Ctrl + B, CCreate new window
Ctrl + B, NNext window
Ctrl + B, PPrevious window
Ctrl + B, "Split horizontally
Ctrl + B, %Split vertically
Ctrl + B, OSwitch to next pane
Ctrl + B, XKill current pane
Ctrl + B, ,Rename window
Ctrl + B, DDetach session

🧠 Pro Tips

  • Create a .tmux.conf file to customize behavior (e.g., change prefix to Ctrl + A like GNU Screen).
  • Use tmux-resurrect and tmux-continuum plugins to save/restore sessions.
  • Combine with ssh for persistent remote workflows.

📝 Where to Put .tmux.conf

Create or edit the file at:

~/.tmux.conf

To reload your config without restarting tmux, run:

tmux source-file ~/.tmux.conf

🧱 Basic Structure

Each line in .tmux.conf is a command or setting — think of it as a script that runs every time tmux starts.

✅ Recommended Starter .tmux.conf

# Set prefix to Ctrl + A (like GNU Screen)
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# Enable mouse support (scrolling, pane resizing, click to switch)
set -g mouse on

# Use 256-color terminal
set -g default-terminal "screen-256color"

# Allow window switching with Alt + arrow keys
bind -n M-Left  previous-window
bind -n M-Right next-window

# Split panes (easier keys)
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# Easier pane navigation (Alt + arrow keys)
bind -n M-Up    select-pane -U
bind -n M-Down  select-pane -D
bind -n M-Left  select-pane -L
bind -n M-Right select-pane -R

# Enable pane borders to be more visible
set-option -g pane-border-style fg=blue
set-option -g pane-active-border-style fg=brightgreen

# Shorter status bar
set-option -g status-interval 60
set-option -g status-keys vi

# Customize status bar
set-option -g status-bg black
set-option -g status-fg white
set-option -g status-left-length 30
set-option -g status-right-length 100
set-option -g status-left '#[fg=green]#S'
set-option -g status-right '#[fg=yellow]%Y-%m-%d #[fg=cyan]%H:%M'

# Automatically rename windows
set-option -g allow-rename on

💡 Optional: Install tmux Plugin Manager (TPM)

TPM makes it easy to manage plugins like session restore, battery status, weather, etc.

Install TPM:

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

Add this at the bottom of your .tmux.conf:

# Initialize TMUX plugin manager
set -g @plugin 'tmux-plugins/tpm'
# Example plugins:
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

run '~/.tmux/plugins/tpm/tpm'

Reload tmux and press Ctrl + A then I (capital i) to install plugins.

⚙️ Tips

  • Don’t forget to reload after changes:
tmux source-file ~/.tmux.conf
  • Want to see what keys are bound?
tmux list-keys
  • If you’re debugging config issues, try launching tmux with:
tmux -f /dev/null

to ignore your config file.


📝 Final Thoughts

Whether you’re a sysadmin managing servers, a developer juggling tasks, or just someone who wants more control over the terminal — tmux is a game-changer.

Stay In Touch.

Let's Get Creative.