black electronics

tmux

Common tmux commands for keeping long-running jobs alive over SSH during pentests.

Tmux keeps a terminal session running on a remote box even after you disconnect. This is useful during a pentest when you SSH into a host and want a long-running command (a scan, a brute force, a reverse shell listener) to survive a dropped connection.

Detach and reattach a session

Terminal window
ssh username@remote_host
tmux
your_command

Inside the tmux session, press Ctrl-b then d to detach and close your SSH connection. When you reconnect, reattach with:

Terminal window
tmux attach -t 0

Manage windows

Terminal window
Ctrl-b c # Create a new window in the current session
Ctrl-b 0-9 # Switch to window 0-9
Useful LinksPentest PayloadsCheat Sheets