Stop juggling terminal tabs and start using tmux. This command integrates the terminal multiplexer into your daily routine, offering a seamless way to tile windows, script your environment, and maintain session persistence. It’s the essential tool for anyone looking to maximize their screen real estate and command-line mastery
Sessions
tmux— Start a new sessiontmux new -s mysession— Start a new session with the namemysessiontmux ls— List all running sessionstmux a— Attach to the last sessiontmux a -t mysession— Attach to a specific session by nameCtrl+b d— Detach from the current sessionCtrl+b s— Show all sessions (interactive list)Ctrl+b \$— Rename the current sessiontmux kill-session -t mysession— Kill/delete a specific sessiontmux kill-server— Kill the tmux server and all sessions
Windows (Tabs)
Ctrl+b c— Create a new windowCtrl+b ,— Rename the current windowCtrl+b &— Close the current window (with confirmation)Ctrl+b n— Go to the next windowCtrl+b p— Go to the previous windowCtrl+b 0-9— Switch to window by numberCtrl+b w— List all windows in the current sessionCtrl+b f— Find a window by name
Panes (Splits)
Ctrl+b %— Split the current pane vertically (left/right)Ctrl+b "— Split the current pane horizontally (top/bottom)Ctrl+b o— Cycle through panesCtrl+b q— Show pane numbers (type the number to jump to that pane)Ctrl+b x— Kill the current paneCtrl+b z— Toggle pane zoom (maximize/restore)Ctrl+b !— Convert the current pane into a new windowCtrl+b \{or\}— Swap the current pane with the previous or next oneCtrl+b Space— Toggle between different pane layouts
Resizing Panes
Ctrl+b :— Enter command mode, then type:resize-pane -D— Resize downresize-pane -U— Resize upresize-pane -L— Resize leftresize-pane -R— Resize rightresize-pane -D 10— Resize down by 10 cells
Ctrl+b+Arrow Keys(hold Ctrl) — Resize pane incrementally
Copy Mode (Vi Mode)
To enable vi keys, add setw -g mode-keys vi to your .tmux.conf.
Ctrl+b \[— Enter copy modeq— Exit copy modeg— Go to the topG— Go to the bottomSpace— Begin selectionEnter— Copy selectionCtrl+b \]— Paste the most recently copied buffer/— Search forward?— Search backwardn— Next search match
Miscellaneous
Ctrl+b t— Show a large digital clockCtrl+b ?— List all key bindingsCtrl+b :— Enter the tmux command prompt:setw synchronize-panes— Toggle “Sync Panes” (send input to all panes in the window)