What is Tmux?
Tmux is a terminal multiplexer that lets you:
Run multiple terminal sessions in one window
Detach and reattach to sessions
Split your terminal into panes
Keep processes running after disconnecting
Basic Concepts
Sessions: Independent workspaces
Windows: Tabs within a session
Panes: Splits within a window
Getting Started
Installation
``
bash
# macOS
brew install tmux
# Ubuntu/Debian
sudo apt install tmux
# Fedora
sudo dnf install tmux
`
Essential Commands
`
bash
# Start new session
tmux new -s mysession
# Detach from session
# Press: Ctrl-b d
# List sessions
tmux ls
# Attach to session
tmux attach -t mysession
# Kill session
tmux kill-session -t mysession
`
Key Bindings
All commands start with the prefix key: Ctrl-b
Windows
c
- Create new window
n
- Next window
p
- Previous window
,
- Rename window
&
- Kill window
Panes
%
- Split vertically
"
- Split horizontally
Arrow keys - Navigate panes
x
- Kill pane
z
- Toggle pane zoom
Configuration
Create ~/.tmux.conf
:
`
bash
# Change prefix to Ctrl-a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Enable mouse
set -g mouse on
# Start windows at 1
set -g base-index 1
# Faster escape time
set -sg escape-time 0
# Better splits
bind | split-window -h
bind - split-window -v
``
Conclusion
Tmux is essential for remote work and managing complex development environments. Start with the basics and gradually add to your configuration as you discover your needs.