daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR
git clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
Log | Files | Refs | README | LICENSE

tmux.md (9164B)


      1 ---
      2 title: "tmux"
      3 description: "tmux sessions, windows, panes, copy mode and config bindings for terminal multiplexing."
      4 category: linux-it
      5 tags: [linux, terminal, productivity]
      6 tools: [tmux]
      7 difficulty: beginner
      8 updated: "2026-08-09"
      9 source: "vault:Misc/tmux.md"
     10 ---
     11 
     12 # tmux
     13 
     14 **Prefix Key: `Ctrl+a`** (changed from the default `Ctrl+b`)
     15 
     16 > **Note —** This sheet documents a customized tmux config (remapped prefix, vim-style pane nav, and several TPM plugins). Bindings marked as plugin features assume those plugins are installed.
     17 
     18 ## Getting Started
     19 
     20 | Command | Action |
     21 |:---|:---|
     22 | `tmux new -s name` | Create new session with name |
     23 | `tmux ls` | List all sessions |
     24 | `tmux a -t name` | Attach to existing session |
     25 | `tmux kill-session -t name` | Kill specific session |
     26 | `tmux kill-server` | Kill all tmux sessions |
     27 
     28 ## Session Management
     29 
     30 | Keybind | Action |
     31 |:---|:---|
     32 | `Ctrl+a` then `d` | Detach from current session |
     33 | `Ctrl+a` then `$` | Rename current session |
     34 | `Ctrl+a` then `(` | Switch to previous session |
     35 | `Ctrl+a` then `)` | Switch to next session |
     36 | `Ctrl+a` then `s` | List all sessions (interactive) |
     37 | `Ctrl+a` then `Shift+s` | Save session (resurrect) |
     38 | `Ctrl+a` then `Shift+r` | Restore session (resurrect) |
     39 
     40 Sessions auto-save every 15 minutes (tmux-continuum).
     41 
     42 ## Window Management (Tabs)
     43 
     44 | Keybind | Action |
     45 |:---|:---|
     46 | `Ctrl+a` then `c` | Create new window |
     47 | `Ctrl+a` then `,` | Rename current window |
     48 | `Ctrl+a` then `n` | Next window |
     49 | `Ctrl+a` then `p` | Previous window |
     50 | `Ctrl+a` then `0-9` | Jump to window number |
     51 | `Alt+1` .. `Alt+5` | Quick jump to window 1-5 (no prefix needed) |
     52 | `Ctrl+a` then `w` | List all windows (interactive) |
     53 | `Ctrl+a` then `&` | Kill current window |
     54 | `Ctrl+a` then `f` | Find window by name |
     55 | `Ctrl+a` then `l` | Last active window |
     56 
     57 ## Pane Management (Splits)
     58 
     59 ### Creating Panes
     60 | Keybind | Action |
     61 |:---|:---|
     62 | `Ctrl+a` then `\|` | Split pane horizontally (side by side) |
     63 | `Ctrl+a` then `-` | Split pane vertically (top/bottom) |
     64 
     65 ### Navigation
     66 | Keybind | Action |
     67 |:---|:---|
     68 | `Ctrl+a` then `h/j/k/l` | Move to left/bottom/top/right pane |
     69 | `Ctrl+h/j/k/l` | Move between panes (no prefix, vim-aware) |
     70 | `Alt+Left/Down/Up/Right` | Move between panes (no prefix) |
     71 
     72 ### Resizing Panes
     73 | Keybind | Action |
     74 |:---|:---|
     75 | `Ctrl+a` then `Shift+h` | Resize pane left by 5 cells |
     76 | `Ctrl+a` then `Shift+j` | Resize pane down by 5 cells |
     77 | `Ctrl+a` then `Shift+k` | Resize pane up by 5 cells |
     78 | `Ctrl+a` then `Shift+l` | Resize pane right by 5 cells |
     79 
     80 ### Pane Layouts
     81 | Keybind | Action |
     82 |:---|:---|
     83 | `Ctrl+a` then `Shift+e` | Even horizontal layout |
     84 | `Ctrl+a` then `Shift+v` | Even vertical layout |
     85 | `Ctrl+a` then `Shift+t` | Tiled layout |
     86 | `Ctrl+a` then `Space` | Cycle through all layouts |
     87 
     88 ### Other Pane Actions
     89 | Keybind | Action |
     90 |:---|:---|
     91 | `Ctrl+a` then `z` | Toggle pane zoom (fullscreen) |
     92 | `Ctrl+a` then `x` | Kill current pane |
     93 | `Ctrl+a` then `!` | Break pane into new window |
     94 | `Ctrl+a` then `{` | Move pane left |
     95 | `Ctrl+a` then `}` | Move pane right |
     96 | `Ctrl+a` then `Ctrl+o` | Rotate panes clockwise |
     97 | `Ctrl+a` then `Shift+s` | Synchronize panes (type in all at once) |
     98 | `Ctrl+a` then `q` | Show pane numbers |
     99 
    100 ## Copy Mode (Vim-Style)
    101 
    102 ### Entering/Exiting
    103 | Keybind | Action |
    104 |:---|:---|
    105 | `Ctrl+a` then `[` | Enter copy mode |
    106 | `q` | Exit copy mode |
    107 | `Esc` | Exit copy mode |
    108 
    109 ### Navigation in Copy Mode
    110 | Keybind | Action |
    111 |:---|:---|
    112 | `h/j/k/l` | Move left/down/up/right |
    113 | `w` | Move forward by word |
    114 | `b` | Move backward by word |
    115 | `g` | Go to top of buffer |
    116 | `Shift+g` | Go to bottom of buffer |
    117 | `Ctrl+u` | Page up |
    118 | `Ctrl+d` | Page down |
    119 
    120 ### Selection & Copying
    121 | Keybind | Action |
    122 |:---|:---|
    123 | `v` | Start selection (visual mode) |
    124 | `Shift+v` | Select entire line |
    125 | `y` | Copy selection and exit copy mode |
    126 | `r` | Toggle rectangle selection |
    127 | `Ctrl+a` then `Shift+p` | Paste buffer |
    128 | `Ctrl+a` then `]` | Paste buffer (alternative) |
    129 
    130 ### Searching in Copy Mode
    131 | Keybind | Action |
    132 |:---|:---|
    133 | `/` | Search forward |
    134 | `?` | Search backward |
    135 | `n` | Next search result |
    136 | `Shift+n` | Previous search result |
    137 
    138 ## Smart Search (Copycat Plugin)
    139 
    140 | Keybind | Action |
    141 |:---|:---|
    142 | `Ctrl+a` then `Ctrl+i` | Search for IP addresses |
    143 | `Ctrl+a` then `Ctrl+u` | Search for URLs |
    144 | `Ctrl+a` then `Ctrl+f` | Search for file paths |
    145 | `Ctrl+a` then `Ctrl+h` | Search for hashes (SHA, MD5) |
    146 | `Ctrl+a` then `Ctrl+d` | Search for digits |
    147 | `n` / `Shift+n` | Next / previous match |
    148 | `Enter` | Copy selection |
    149 
    150 ## Text Extraction (Extrakto Plugin)
    151 
    152 | Keybind | Action |
    153 |:---|:---|
    154 | `Ctrl+a` then `Tab` | Open extrakto (extract all text) |
    155 | `Tab` | Toggle filter mode (in extrakto) |
    156 | `Ctrl+j` or `Down` | Navigate down results |
    157 | `Ctrl+k` or `Up` | Navigate up results |
    158 | `Enter` | Copy selection to clipboard |
    159 | `Ctrl+o` | Open selection in editor |
    160 | `Esc` | Cancel/exit |
    161 
    162 ## Logging & Recording
    163 
    164 | Keybind | Action |
    165 |:---|:---|
    166 | `Ctrl+a` then `Shift+l` | Toggle logging (start/stop recording) |
    167 | `Ctrl+a` then `Ctrl+s` | Screenshot pane (save visible content) |
    168 | `Ctrl+a` then `Ctrl+p` | Save complete history (all scrollback) |
    169 
    170 Logs saved to `~/tmux-logs/`. Filename format: `tmux-sessionname-window-pane-20260131_120000.log`
    171 
    172 ## Quick Copy (Fingers Plugin)
    173 
    174 | Keybind | Action |
    175 |:---|:---|
    176 | `Ctrl+a` then `Shift+f` | Show copy hints on screen |
    177 | Type the hint | Copy text at that location |
    178 | `Enter` | Copy main match |
    179 | `Tab` | Toggle hint mode |
    180 | `Esc` | Cancel |
    181 
    182 ## Fuzzy Finder (tmux-fzf Plugin)
    183 
    184 | Keybind | Action |
    185 |:---|:---|
    186 | `Ctrl+a` then `Ctrl+f` | Open fuzzy finder menu |
    187 | `Ctrl+j` or `Down` | Navigate down |
    188 | `Ctrl+k` or `Up` | Navigate up |
    189 | `Enter` | Select item |
    190 | `Esc` | Cancel |
    191 
    192 ## File Sidebar (Sidebar Plugin)
    193 
    194 | Keybind | Action |
    195 |:---|:---|
    196 | `Ctrl+a` then `Tab` | Toggle file tree sidebar |
    197 | `Ctrl+a` then `Backspace` | Toggle sidebar and focus it |
    198 | `Enter` | Open file (when in sidebar) |
    199 | `q` | Close sidebar |
    200 
    201 ## Open URLs/Files (Open Plugin)
    202 
    203 In copy mode:
    204 
    205 | Keybind | Action |
    206 |:---|:---|
    207 | `o` | Open highlighted URL or file |
    208 | `Ctrl+o` | Open highlighted text in `$EDITOR` |
    209 | `Shift+s` | Web search highlighted text |
    210 
    211 ## Pentesting Tools (Custom Bindings)
    212 
    213 | Keybind | Action |
    214 |:---|:---|
    215 | `Ctrl+a` then `Shift+y` | Open Python window |
    216 | `Ctrl+a` then `Shift+n` | Open Nmap window |
    217 | `Ctrl+a` then `Shift+m` | Open Metasploit window |
    218 | `Ctrl+a` then `Shift+b` | Open Burp Suite window |
    219 | `Ctrl+a` then `Shift+g` | Open Gobuster window |
    220 
    221 ## System & Configuration
    222 
    223 | Keybind | Action |
    224 |:---|:---|
    225 | `Ctrl+a` then `r` | Reload tmux config |
    226 | `Ctrl+a` then `?` | Show all key bindings |
    227 | `Ctrl+a` then `:` | Enter tmux command mode |
    228 | `Ctrl+a` then `t` | Show clock |
    229 | `Ctrl+a` then `b` | Toggle status bar on/off |
    230 | `Ctrl+a` then `Ctrl+k` | Clear scrollback buffer |
    231 | `Ctrl+a` then `i` | Show tmux info |
    232 
    233 ## Plugin Management (TPM)
    234 
    235 | Keybind | Action |
    236 |:---|:---|
    237 | `Ctrl+a` then `Shift+i` | Install plugins |
    238 | `Ctrl+a` then `Shift+u` | Update plugins |
    239 | `Ctrl+a` then `Alt+u` | Uninstall unused plugins |
    240 
    241 ## Common Workflows
    242 
    243 ### Pentesting Setup
    244 ```text
    245 1. tmux new -s htb-box
    246 2. Ctrl+a then |        (split right)
    247 3. Ctrl+a then -        (split bottom)
    248 4. Ctrl+a then Shift+n  (open Nmap window)
    249 5. Ctrl+a then Shift+l  (start logging)
    250 ```
    251 
    252 ### Finding IPs in Scan Output
    253 ```text
    254 1. Run: nmap -sV 10.10.10.0/24
    255 2. Ctrl+a then Ctrl+i   (search for IPs)
    256 3. n                    (cycle through results)
    257 4. Enter                (copy to clipboard)
    258 ```
    259 
    260 ### Parallel Commands
    261 ```text
    262 1. Ctrl+a then |        (split panes 4 ways)
    263 2. Ctrl+a then -
    264 3. Ctrl+a then h
    265 4. Ctrl+a then -
    266 5. Ctrl+a then Shift+s  (synchronize panes)
    267 6. ssh user@host1       (types in ALL panes)
    268 7. Ctrl+a then Shift+s  (unsynchronize)
    269 ```
    270 
    271 ### Extract All IPs/URLs
    272 ```text
    273 1. Ctrl+a then Tab      (extrakto)
    274 2. Type to filter
    275 3. Enter to copy
    276 ```
    277 
    278 ### Session Persistence
    279 ```bash
    280 # Start work
    281 tmux new -s work
    282 
    283 # Work crashes or you disconnect...
    284 
    285 # Restore everything
    286 tmux a -s work
    287 # Or if session was killed: Ctrl+a then Shift+r (restore last session)
    288 ```
    289 
    290 ## Mouse Support
    291 
    292 Enabled. You can click to select panes, click windows in the status bar, scroll to navigate history, drag to resize panes, and drag to select text (auto-copies).
    293 
    294 ## Pro Tips
    295 
    296 1. Always name your sessions: `tmux new -s project-name`
    297 2. Detach, never close: `Ctrl+a` then `d` (session keeps running)
    298 3. Start logging for reports: `Ctrl+a` then `Shift+l`
    299 4. Find IPs instantly: `Ctrl+a` then `Ctrl+i`
    300 5. Extract anything: `Ctrl+a` then `Tab`
    301 6. Synchronize for parallel work: `Ctrl+a` then `Shift+s`
    302 7. Sessions survive SSH disconnects
    303 8. Zoom pane for focus: `Ctrl+a` then `z`
    304 9. Quick window access: `Alt+1` through `Alt+5`
    305 
    306 ## Emergency Commands
    307 
    308 | Command | Action |
    309 |:---|:---|
    310 | `tmux kill-server` | Kill ALL tmux sessions |
    311 | `Ctrl+a` then `:kill-session` | Kill current session |
    312 | `Ctrl+a` then `Ctrl+k` | Clear screen/history |
    313 | `tmux a` | Attach to last session |
    314 | `Ctrl+a` then `?` | Show all bindings if confused |