Here’s a tmux cheat sheet with essential commands that will boost your productivity and performance when using tmux. These commands will help you manage sessions, windows, panes, and navigation, which are crucial for a smooth workflow.

Session Management Start a new tmux session:

tmux new-session -s session-name Replace session-name with your desired session name.

List all tmux sessions:

tmux list-sessions Attach to an existing session:

tmux attach-session -t session-name Detach from the current session: Inside tmux, press Ctrl + b followed by d to detach from the session and leave it running in the background.

Kill a tmux session:

tmux kill-session -t session-name Rename a session: Inside tmux, press Ctrl + b followed by : and then type:

rename-session new-session-name Window Management Create a new window: Press Ctrl + b, then c to create a new window in the current session.

Switch to the next window: Press Ctrl + b, then n.

Switch to the previous window: Press Ctrl + b, then p.

Switch to a specific window: Press Ctrl + b, then the window number (0, 1, 2, etc.).

Rename a window: Inside tmux, press Ctrl + b, then , to rename the current window.

Close the current window: Inside tmux, press Ctrl + b, then & and confirm to kill the window.

Pane Management Split window horizontally: Press Ctrl + b, then % to split the current window into two horizontal panes.

Split window vertically: Press Ctrl + b, then " to split the current window into two vertical panes.

Navigate between panes: Press Ctrl + b, then use the arrow keys (←, ↑, ↓, →) to switch between panes.

Resize panes: Press Ctrl + b, then hold Ctrl and use the arrow keys to resize the active pane.

Close the current pane: Press Ctrl + b, then x, and confirm to kill the current pane.

Swap panes: Press Ctrl + b, then o to swap between the current and the next pane.

Session/Panes/Windows Navigation Move between windows quickly: Press Ctrl + b, then a number (0, 1, 2, etc.) to directly jump to that window.

Move between panes: Press Ctrl + b, then the arrow keys (←, ↑, ↓, →) to move between adjacent panes.

List all windows: Press Ctrl + b, then w to bring up a window list and select one to jump to.

Zoom in/out of a pane: Press Ctrl + b, then z to zoom in on the current pane (makes it full-screen). Press Ctrl + b and z again to return to the normal layout.

Copy Mode Enter copy mode: Press Ctrl + b, then [. This allows you to scroll back through the output and copy text.

Scroll up/down: In copy mode, use the arrow keys or Page Up / Page Down to scroll.

Start selection: Press Space to begin selection.

Copy the selection: After selecting text, press Enter to copy the text to tmux's clipboard.

Paste the copied text: Press Ctrl + b, then ] to paste the copied text.

Session Synchronization Synchronize input across all panes: Press Ctrl + b, then : and type: setw synchronize-panes on This will sync your input across all panes. To turn it off, use: setw synchronize-panes off Search and History Search for text in the terminal: Press Ctrl + b, then / to search backward or ? to search forward. Then type your search term and press Enter.

Clear the screen: Press Ctrl + b, then Ctrl + l to clear the current pane (similar to clear).

Performance/Optimization Set a maximum history buffer size: In your ~/.tmux.conf file, you can set the scrollback buffer limit, which can improve performance in long-running sessions.

set-option -g history-limit 10000 Disable pane switching delay: You can also reduce delays in pane switching by adding this to your ~/.tmux.conf:

set -g terminal-overrides 'xterm*:smcup@:rmcup@' Useful Shortcuts Kill all panes in the current window: Press Ctrl + b, then &, then type y to confirm killing the current window.

Quickly switch between windows: Press Ctrl + b, then n for next window or p for the previous window.

List all sessions: You can list all tmux sessions at any time by running:

tmux ls Customizations Set custom key bindings: You can bind keys to perform specific actions in ~/.tmux.conf. For example:

bind r source-file ~/.tmux.conf ; display-message "Config reloaded!" This will bind Ctrl + b followed by r to reload the tmux configuration.

Set the default terminal mode (useful for non-standard terminals):

set -g default-terminal "screen-256color" Quick Tips Prefix key: The default tmux prefix key is Ctrl + b, followed by the command or action. Session names: Use meaningful session names when creating new sessions to easily identify them. Configuration file: ~/.tmux.conf is where you can put custom tmux settings to personalize your workflow. Mastering these commands will drastically increase your productivity and performance when using tmux for your terminal-based workflow. Let me know if you'd like more details on any of these!