In the previous post, you worked with sessions and windows. This time, you stay inside one window and divide it into panes so you can edit code, watch a server, and check Git without leaving tmux.
This post is for a beginner or early-intermediate reader who already knows how to open a tmux session and move between windows. The examples use terminal recordings so you can see the layout changes instead of guessing from an ASCII sketch.
What this post covers
- Split one window into multiple panes
- Move, resize, close, and zoom panes
- Create a practical
~/.tmux.conf
- Enable mouse support and test it safely
- Rebuild a three-pane developer layout
Before you start
- A terminal with tmux installed
- Vim or nano for editing
~/.tmux.conf
- Basic comfort with sessions and windows from part 3
Keep one idea in mind before you start: panes live inside a window, and windows live inside a session. If you close the only remaining pane, you also close that window.
Mouse support in this post assumes tmux 2.1 or later. Some resize shortcuts, especially Alt+Arrow, can also depend on your terminal emulator on macOS.
Practice 1: Split panes
Start with the two split commands you will use most often. First make the split, then notice which pane becomes active.
Horizontal split (top/bottom) - Ctrl+b + "
Ready. Press Replay to run the scripted session.
Result: the top pane can hold your editor while the bottom pane keeps the running command visible.
Vertical split (left/right) - Ctrl+b + %
Ready. Press Replay to run the scripted session.
Result: use the left pane for the long-running process and the right pane for Git, tests, or quick commands.
Move between panes
Learn the arrow-key movement first. It is the most obvious version when you are still building muscle memory.
Ready. Press Replay to run the scripted session.
Notice the active-pane highlight. That is your visual cue for where the next keystroke will go.
Learn these first:
| Shortcut |
Action |
Ctrl+b Up |
Move to the pane above |
Ctrl+b Down |
Move to the pane below |
Ctrl+b Left |
Move left |
Ctrl+b Right |
Move right |
Then add these once the basics feel natural:
| Shortcut |
Action |
Ctrl+b o |
Cycle to the next pane |
Ctrl+b ; |
Jump to the previous pane |
Resize panes
Use resize when the default split gives too much space to logs or too little room to the editor.
Ctrl+b Alt+Up Grow upward
Ctrl+b Alt+Down Grow downward
Ctrl+b Alt+Left Grow left
Ctrl+b Alt+Right Grow right
Hold Ctrl+b, press Alt+Arrow, and tap a few times until the pane reaches a comfortable size. On some macOS terminals, Alt+Arrow may need terminal-specific key mapping.
Close a pane
Ctrl+b x
tmux asks for confirmation:
Kill pane? (y/n)
Press y, or run exit inside that pane if you want to close it from the shell itself.
Zoom a pane - Ctrl+b + z
Use zoom when one pane suddenly needs your full attention for a moment.
Ready. Press Replay to run the scripted session.
Press the same shortcut again to return to the original layout.
Practice 2: Create ~/.tmux.conf
Now that you have seen the pane commands, add a small config so the workflow feels better every time you start tmux.
Make the config file
If you use Vim:
cd ~
vim .tmux.conf
If you use nano instead:
cd ~
nano .tmux.conf
Add baseline settings
Each line below has one job. Read the comment before you save it so you know what will change.
# Let tmux receive mouse clicks, dragging, and scrolling.
set -g mouse on
# Use a widely supported 256-color terminal setting.
set -g default-terminal "screen-256color"
# Start window and pane numbering at 1 instead of 0.
set -g base-index 1
set -g pane-base-index 1
# Optional: use Vim-style pane movement.
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Keep window names stable instead of renaming them automatically.
set-option -g allow-rename off
# Keep more scrollback history.
set -g history-limit 10000
# Simple status bar colors. Adjust them if your terminal theme makes them hard to read.
set -g status-bg black
set -g status-fg white
In Vim, save and quit with :wq. In nano, press Ctrl+O, then Enter, then Ctrl+X.
Apply the config
Reload the file inside tmux:
tmux source-file ~/.tmux.conf
This updates global settings on the running tmux server, and new sessions will pick up the config automatically. If a setting does not seem to apply cleanly, start a fresh session or fully restart tmux.
Ready. Press Replay to run the scripted session.
Check the result:
- Confirm the status bar still looks readable in your terminal theme
- Open a new session and verify windows now start at
1
- Click a pane to confirm mouse focus works
Test mouse interaction
Start a fresh session:
tmux new -s mouse-test
Then test the mouse in three small ways:
- Click a pane to move focus
- Drag a border to resize panes
- Scroll inside a pane to enter copy mode and inspect earlier output
If you do not see mouse behavior, reload the config again and test in a new session.
Practice 3: Build a real workflow
Now combine the split commands and the config in one repeatable layout. The goal is not a fancy demo. The goal is a layout you can rebuild quickly when you start work.
Web development scenario
Ready. Press Replay to run the scripted session.
Build it in this order:
Ctrl+b % to split left and right
Ctrl+b " to split the right side into top and bottom
- Use resize if you want the left editor pane to be wider than the two helper panes
Final layout:
- Left pane: code or documentation
- Top-right pane: dev server
- Bottom-right pane: Git status, tests, or logs
If you can rebuild this layout without looking at the recap table, you are already using panes in a practical way.
Shortcut recap
Use this as your quick reference after the practice sections.
| Shortcut |
Action |
Ctrl+b " |
Horizontal split |
Ctrl+b % |
Vertical split |
Ctrl+b Up/Down/Left/Right |
Move focus |
Ctrl+b Alt+Arrow |
Resize pane |
Ctrl+b x |
Close pane |
Ctrl+b z |
Toggle zoom |
Ctrl+b q |
Show pane numbers |
Troubleshooting
My config did not load
Run the checks in this order:
ls -la ~/.tmux.conf
tmux source-file ~/.tmux.conf 2>&1
tmux new -s fresh-test
If the second command prints an error, fix the file and reload again. If the file reloads but behavior still looks old, restart tmux completely:
tmux kill-server
tmux new -s fresh
Mouse actions still do not work
Check whether the setting exists:
grep mouse ~/.tmux.conf
Then reload and test in a new session:
tmux source-file ~/.tmux.conf
tmux new -s mouse-test
If clicking still does nothing, the issue may be your terminal emulator rather than tmux itself.
Alt+Arrow does not resize panes
That shortcut depends on your terminal passing the key combination through to tmux. If it does not work, keep using the split and movement commands first, then check your terminal keybinding settings later.
Practice checklist
Tmux series complete
You now have the core tmux workflow: sessions, windows, panes, and a small configuration file that makes daily work easier.
What you learned across the series:
- Why tmux is worth learning
- How to install it and start the first session
- How sessions and windows stay organized
- How panes and configuration turn tmux into a repeatable workflow
Tmux series overview
💬 댓글
이 글에 대한 의견을 남겨주세요