Overview¶
tmux is a terminal multiplexer that allows you to:
-
Run multiple terminal sessions in one window
-
Split the terminal into panes
-
Detach and reattach sessions
-
Keep processes running even after disconnect
It is widely used in:
-
Remote server management
-
Long-running tasks
-
Cybersecurity workflows
Starting tmux¶
Explanation
-
Starts a new tmux session
-
Opens a new terminal environment inside your current shell
Pane Management¶
Split Terminal Horizontally¶
Explanation
- Splits the screen into left and right panes
Split Terminal Vertically¶
Explanation
- Splits the screen into top and bottom panes
Navigate Between Panes¶
Explanation
- Move between panes using arrow keys
Window Management¶
Create New Window¶
Explanation
- Opens a new window inside the same session
Switch Between Windows¶
Explanation
- Switch using window number
Rename Window¶
Explanation
- Allows assigning a custom name to the current window
Session Management¶
Detach Session¶
Explanation
-
Detaches session without stopping processes
-
Keeps tasks running in background
List Sessions¶
Explanation
- Displays all active tmux sessions
Attach to Session¶
Example
Create Named Session¶
Explanation
- Creates a session with a custom name
Rename Session¶
Explanation
- Renames session
0tonewname
Practical Examples¶
Start a Named Session¶
Run Task and Detach¶
Reattach Later¶
Use Multiple Panes¶
-
Split screen
-
Run different commands simultaneously
-
Monitor logs in one pane and run tools in another
Important Notes¶
-
Default prefix key is
Ctrl + b -
All commands are executed after pressing prefix
-
Sessions persist even after SSH disconnection
-
Useful for long-running scripts and scans
Summary Table¶
| Action | Command |
|---|---|
| Start tmux | tmux |
| Split horizontally | Ctrl + b % |
| Split vertically | Ctrl + b " |
| Switch panes | Ctrl + b + arrows |
| New window | Ctrl + b c |
| Switch window | Ctrl + b <number> |
| Rename window | Ctrl + b , |
| Detach session | Ctrl + b d |
| List sessions | tmux ls |
| Attach session | tmux attach -t name |
| Create named session | tmux new -s name |
| Rename session | tmux rename-session |
Conclusion¶
tmux is a powerful tool for:
-
Managing multiple terminal sessions
-
Maintaining persistent workflows
-
Improving productivity in Linux environments
Mastering tmux is especially useful for system administrators and cybersecurity professionals working on remote systems.