Working constantly in the terminal and want to level up your workflow? tmux
can help transform how you manage sessions, split panes, reuse work across SSH, and stay productive. In this post, Iâll walk you through tmux like a pro â core concepts, commands, config tricks, tips, and plugins that really make a difference.
Table of Contents
- What is tmux & Why Use It
- Core Concepts
- Essential tmux Commands
-
Configuration:
.tmux.conf
Setup - PowerâTips & Best Practices
- Plugins to Supercharge tmux
- Conclusion
What is tmux & Why Use It
tmux
is a terminal multiplexer. Sounds technical, but in simple terms: it lets you:
- Run multiple terminal sessions in one window
- Split a window into panes
- Detach from a session (e.g. when your SSH or terminal dies) and reattach later
- Organize windows, name them, script interactions, customize layouts
If you ever lose connection, want to run multiple jobs at once, or manage complicated shell setupsâtmux saves your bacon.
Core Concepts
Before diving into commands, letâs get the foundations right:
- Session: Your workspace. Think: a major project or context (e.g. âbackendâ, âdeploysâ, âdevâ).
- Window: Within a session, windows are like tabs. Each window can be a separate task.
- Pane: Splits inside a window. You can have multiple panes side by side or stacked.
Example layout:
Session: Work
âââ Window 1: server
â âââ Pane 1: logs
â âââ Pane 2: shell
âââ Window 2: editor
`
Essential tmux Commands
Here are the commands youâll use most of the time. Prefix stands for Ctrl + b
(unless you change it).
Action | Command / Shortcut |
---|---|
Start a new session | tmux new -s mysession |
Attach to a session | tmux attach -t mysession |
List sessions | tmux ls |
Detach from session |
Ctrl + b , then d
|
Create new window |
Ctrl + b , then c
|
Switch windows |
Ctrl + b , then 0 â9
|
Rename window |
Ctrl + b , then ,
|
Split pane horizontally |
Ctrl + b , then "
|
Split pane vertically |
Ctrl + b , then %
|
Navigate panes |
Ctrl + b + arrow keys or Ctrl + b then o
|
Resize pane |
Ctrl + b , then hold Ctrl + ââââ
|
Kill (close) pane |
Ctrl + b , then x
|
Reload config file |
Ctrl + b , then : then source-file ~/.tmux.conf
|
Configuration: .tmux.conf
Setup
Customizing tmux really unlocks efficiency. Create or edit ~/.tmux.conf
and add things like:
`tmux
Easier prefix: from Ctrl-b to Ctrl-a
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
Enable mouse support (click/select panes, resize, etc.)
set -g mouse on
Vimâstyle pane movement
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
Resize panes with Alt + Arrow keys
bind -n M-Left resize-pane -L 5
bind -n M-Right resize-pane -R 5
bind -n M-Up resize-pane -U 5
bind -n M-Down resize-pane -D 5
Better terminal colors
set -g default-terminal "screen-256color"
Status bar customization
set -g status-bg black
set -g status-fg green
set -g status-interval 2
Then reload with:
`bash
tmux source-file ~/.tmux.conf
`
PowerâTips & Best Practices
- Name your sessions â helps when you have many floating around.
- Split panes wisely â avoid too many splits; keep things manageable.
-
Use copyâmode:
-
Ctrl + b
then[
- Navigate, press
Space
to start selection,Enter
to copy - Paste with
Ctrl + b
then]
-
Monitor memory and load when using many panes/windows, especially on constrained machines (Raspberry Pis, etc.).
Make short aliases for frequent tmux commands (e.g.
tma = tmux attach
,tmls = tmux ls
)Donât shy away from remapping keys if defaults donât match your workflow (e.g. if you're used to vim splits, or Emacs, etc.).
Plugins to Supercharge tmux
Plugins help you add features without reinventing the wheel. One popular manager is TPM (tmuxâpluginâmanager). Hereâs how to get started:
`bash
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
`
In your .tmux.conf
, add:
`tmux
set -g @plugin 'tmux-plugins/tpm'
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'
`
After you reload tmux:
`bash
Press your prefix (e.g. Ctrlâa or whatever you set), then I (capital i)
TPM will install any listed plugins
`
Some useful plugins:
- tmux-resurrect: saves/restores tmux sessions
- tmux-continuum: autoâsaving / periodic backups of sessions
- tmux-sensible: sane defaults for many settings
Conclusion
If you adopt tmux seriously, youâll notice:
- less context switching
- safer remote work (sessions survive SSH drops)
- more organized workflow with windows & panes
- ability to automate workspace setups
Give yourself time to tune your tmux config. What feels clunky now will become muscle memory. Before you know it, you're navigating panes without thinking, detaching sessions while traveling, and managing services, logs, editors all in one place.
Happy multiplexing! đ ď¸
If you try this out, Iâd love to hear your favorite tmux trick or custom keybinding. Leave a comment below!
`
đ Tips for Publishing
- Use meaningful tags:
tmux
,productivity
,linux
,tooling
, maybecli
. - Add a cover image (terminal screenshot or layout) to make it visually engaging.
- Proofreadâespecially code blocks, formatting. Make sure commands render properly.
- Once published: share in Linux / Dev communities; engage with commenters.
Top comments (0)