Here are the essential tmux commands to get you started:
tmux- Start a new sessiontmux new -s sessionname- Start a new named sessiontmux ls- List all sessionstmux attach -t sessionname- Attach to a sessiontmux kill-session -t sessionname- Kill a sessiontmux kill-server- Kill the tmux server
tmux capture-pane -t ui -S -50 -ptmux pipe-pane -t session_name -o 'cat >> session_name.log'
tmux pipe-pane -t session_name # to stop loggingPress the prefix key, then release it, then press the command key.
Ctrl+b d- Detach from sessionCtrl+b s- List and switch sessions
Ctrl+b c- Create new windowCtrl+b n- Next windowCtrl+b p- Previous windowCtrl+b 0-9- Switch to window by numberCtrl+b ,- Rename current windowCtrl+b &- Kill current window
Ctrl+b %- Split vertically (side by side)Ctrl+b "- Split horizontally (top/bottom)Ctrl+b arrow keys- Navigate between panesCtrl+b x- Kill current paneCtrl+b z- Toggle pane zoom (fullscreen)Ctrl+b {or}- Swap pane positions
Ctrl+b ?- Show all key bindingsCtrl+b :- Enter command modeCtrl+b [- Enter copy mode (use arrow keys to scroll, q to quit)
- Start tmux:
tmux new -s work - Create windows for different tasks:
Ctrl+b c - Split panes as needed:
Ctrl+b %orCtrl+b " - Detach when done:
Ctrl+b d - Reattach later:
tmux attach -t work
These commands will cover most of your daily tmux usage!