Tmux Cheatsheet
Snehith,
My Tmux TLDR (Too Long; Didn’t Read) cheatsheet, grouped for easier understanding:
C-b: This is the prefix key. You’ll pressCtrl+bthen the key combination for the command.~/.tmux.conf: This file is where you customize tmux. You can change keybindings, layouts, and more.?: Always useC-b ?to see a list of available commands. It’s your friend!
1. Basic Navigation & Window Management:
C-b c: Create a new window. (New tab)C-b n: Next window. (Next tab)C-b p: Previous window. (Previous tab)C-b <number>: Switch to window by number. (Go to specific tab)C-b ": Access the window list. (See all tabs)C-b x: Kill the current window. (Close tab)C-b d: Kill the current window (prompt for confirmation). (Close tab)
2. Pane Management (Splitting the screen):
C-b s: Split window vertically. (Split screen up/down)C-b x: Split window horizontally. (Split screen left/right)C-b <arrow key>: Move to the pane in the direction of the arrow key.C-b <number>: Switch to pane by number. (Go to specific screen section)C-b .: Duplicate the current pane. (Clone screen section)C-b <letter>: Go to pane that’s associated with the given letter. (e.g.,C-b tgoes to pane named “t”)
3. Layout & Configuration:
C-b <number>: Select a layout from the~/.tmux.conffile. (Predefined screen arrangement)C-b r: Reload the~/.tmux.conffile. (Apply configuration changes)C-b ?: Show help. (List of commands)C-b :: Enter command mode. (Type commands directly)
4. Session & Persistence:
C-b s: Save the current session name. (Name your session)C-b q: Quit tmux. (Exit all windows/panes)tmux attach-session -t <session_name>: Attach to an existing session. (Reconnect to a saved session)
5. Other Useful Commands:
C-b %: Toggle copy mode. (Copy/paste text)C-b u: Undo last command. (Revert a mistake)C-b p: Redo last undone command. (Reapply an undone action)C-b ?: Help. (List of commands)C-b <prefix> <key>: Run a command in the current window. (e.g.,C-b ! ls -l)C-b <prefix> <number>: Run a command in the current pane. (e.g.,C-b 1 ls -l)
Tags:
Tech