Module 01 // session control

tmux cockpit.

One target, one named session, three predictable work surfaces. Everything is plugin-free, true-color, mouse-aware and designed not to persist secret-bearing process state.

prefix C-b / C-avi copy modeOSC52100k history
Persistence is intentionally disabled. Tmux Resurrect and Continuum can write pane commands, arguments and scrollback to disk. Detaching keeps the live server running; restarting the server does not restore it.

Session model

htb-session reads the active target, sanitizes its name, and creates a tmux session called htb-<target>. It attaches from a normal terminal or switches clients when already inside tmux.

pe target use keeper
htb-session

# equivalent: select while launching
pe session keeper

Window 1 · recon

A three-pane layout rooted in the target directory. Use it for a main scan, service follow-up and lightweight monitoring.

Window 2 · shell

A clean interactive Zsh window in the same target root for enumeration and tool work.

Window 3 · notes

Opens notes/notes.md in $EDITOR. The file remains local to the target workspace.

Target tree

nmap/, scans/, loot/, web/, exploit/ and notes/ are created with a private root.

Prefix and config

KeysActionNote
Ctrl-bPrimary prefixThe tmux default remains available.
Ctrl-aSecondary prefixScreen-style alternative; follow it with the binding key.
prefix Ctrl-aSend literal secondary prefixUseful when a nested program consumes it.
prefix rReload ~/.tmux.confDisplays a confirmation message.
prefix ?Show all tmux key bindingsBuilt-in tmux help; press q to leave.

Panes

KeysActionDetail
prefix |Split side by sideNew pane inherits the current working directory.
prefix -Split top and bottomNew pane inherits the current working directory.
prefix h j k lMove left, down, up, rightVim-style pane movement.
Alt-← Alt-↓ Alt-↑ Alt-→Move without prefixFast navigation from a normal shell prompt.
prefix H J K LResize by five cellsRepeatable while the key table remains active.
prefix Ctrl-sToggle synchronized panesEvery keystroke goes to every pane in the window. The status message shows on/off.
prefix zZoom current paneBuilt-in binding; press again to restore the layout.
prefix xKill current paneBuilt-in confirmation. Check for foreground jobs first.
Sync-pane caution: disable synchronization before typing passwords or destructive commands. Confirm the status message after pressing prefix + Ctrl-s.

Windows and sessions

Keys / commandActionDetail
prefix cNew windowStarts in the current pane path.
prefix ,Rename windowUseful for service-specific work such as smb or web.
prefix n / pNext / previous windowBuilt-in cycle.
prefix 1…9Select window numberWindow and pane indexes start at 1.
prefix wInteractive treeBrowse sessions, windows and panes.
prefix dDetachThe tmux server and its processes keep running in memory.
tmux lsList sessionsUse before attaching to avoid duplicate workspaces.
tmux attach -t htb-keeperAttach by namehtb-session is normally easier and safer.

HTB bindings

prefix + P · active workspace

Runs ~/.local/bin/htb-session. It switches to or creates the session for the currently active pe target.

prefix + V · VPN window

Creates a window named vpn and runs pe vpn up in the foreground. Stop it with Ctrl+C.

The right side of the status bar shows a VPN indicator when a tun, tap or wg interface exists, plus the active target and clock. An indicator proves an interface exists—not that a specific target is routed through it. Verify with pe vpn route "$IP".

Copy mode and scrollback

KeysAction
prefix [Enter vi copy mode.
h j k lMove inside copy mode; Ctrl-u/Ctrl-d move by half pages.
/ then textSearch backward through pane history; n repeats.
vBegin selection.
y or EnterCopy selection and exit through tmux/OSC52.
qExit without copying.

Tmux keeps up to 100,000 lines per pane in memory. Copy mode deliberately controls the external clipboard; pane applications cannot silently set it through tmux. Clear copied credentials after use.

Recovery and troubleshooting

  • If keystrokes appear in several panes, toggle prefix + Ctrl-s; synchronized panes are probably on.
  • If a pane is zoomed, press prefix + z.
  • If a session already exists, run htb-session instead of creating another one manually.
  • Inspect config messages with tmux show-messages; validate the active terminal with tmux display -p '#{client_termname}'.
  • Use tmux kill-session -t htb-name only after saving work. Avoid tmux kill-server unless you intend to terminate every session.
  • Put personal settings in ~/.config/tmux/local.conf; it is loaded quietly after the managed config.