Cheatography
https://cheatography.com
Are you a heavy command line user? Do you long long-running jobs via the terminal that you don't want to accidentally close even if you lose your connection? If so, tmux is for you!
General Controlsctrl+b | Default Bind Key | bind-key ? | Lists bind-key combinations | bind-key : | Enter config options directly for current session |
Tmux Sessionstmux | start tmux and attach to default session | tmux ls | prints a list of existing tmux sessions | tmux new -s <name> | Create a new named tmux session | tmux a -t <name> | Attach to a named tmux session | tmux kill-session -t <name> | Kill a session when you're done with it | bind-key, $ | (Re)Name a session |
256 Color supportAdd alias tmux="TERM=screen-256color-bce tmux" to your ~/.bash_profile and set -g default-terminal "xterm" to ~/.tmux.conf |
Other useful config file tricksset-option -g pane-active-border-fg <color> | Surround the active pane with a specific color for easier identification | bind '"' split-window -c "#{pane_current_path}" | When splitting a pane horizontally, create the new pane from the current directory | bind % split-window -h -c "#{pane_current_path}" | When splitting a pane vertically, create the new pane from the current cirectory | bind c new-window -c "#{pane_current_path}" | When creating a new window , create from the current directory. | bind-key R source-file ~/.tmux.conf; display-message "~/.tmux.conf is reloaded" | Allows you to bind-key R to reload your tmux config for the current session | setw -g monitor-activity on | Allows tmux to monitor for command/process exits | set -g visual-activity on | When a command exits in a non-active window, visually change the tab list to reflect that |
These go in ~/.tmux.conf
| | Windows / Tabs -bind-key c | Create a new window/tab | bind-key w | List windows/tabs (helps on smaller screens) | bind-key , | (Re)Name a window/tab | bind-key & | Kill current window (confirmation req) | bind-key <number> | Go directly to numbered window | bind-key l | Last Active window/tab | bind-key n | Next window/tab | bind-key | Previous window |
In the status bar (bottom) are the numbers/names of windows/tabs.
Panes (vertical/horizontal splits)bind-key % | Split current pane vertically | bind-key " | Split current pane horizontally | bind-key q | Show numeric pane values (red is active) | bind-key o | Cycle through panes | bind-key x | Kill current pane (req confirmation) | bind-key ! | Close all panes except current (req conf) | bind-key + | Break pane into new tab/window | bind-key - | Restore pane from new tab to old tab | bind-key <arrow keys> | Navigate around panes |
There are many other key-bindings for resizing panes that are worth learning, but out of scope for a basic cheatsheet. Using the mouse modes for resizing is also helpful.
Mouse Supportsetw -g mode-mouse on | enable mouse integration | setw -g mouse-select-pane on | use the mouse to select panes | setw -g mouse-resize-pane on | use the mouse to resize panes | setw -g mouse-select-window on | use the mouse to select windows/tabs |
These go in ~/.tmux.conf
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets