Skip to content

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

tmux

Explanation

  • Starts a new tmux session

  • Opens a new terminal environment inside your current shell


Pane Management

Split Terminal Horizontally

Ctrl + b %

Explanation

  • Splits the screen into left and right panes

Split Terminal Vertically

Ctrl + b "

Explanation

  • Splits the screen into top and bottom panes

Ctrl + b + Arrow Keys

Explanation

  • Move between panes using arrow keys

Window Management

Create New Window

Ctrl + b c

Explanation

  • Opens a new window inside the same session

Switch Between Windows

Ctrl + b 0
Ctrl + b 1
Ctrl + b 2

Explanation

  • Switch using window number

Rename Window

Ctrl + b ,

Explanation

  • Allows assigning a custom name to the current window

Session Management

Detach Session

Ctrl + b d

Explanation

  • Detaches session without stopping processes

  • Keeps tasks running in background


List Sessions

tmux ls

Explanation

  • Displays all active tmux sessions

Attach to Session

tmux attach -t session_name

Example

tmux attach -t 0

Create Named Session

tmux new -s mysession

Explanation

  • Creates a session with a custom name

Rename Session

tmux rename-session -t 0 newname

Explanation

  • Renames session 0 to newname

Practical Examples

Start a Named Session

tmux new -s pentest

Run Task and Detach

Ctrl + b d

Reattach Later

tmux attach -t pentest

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.