Tutorial Link: Youtube, Bilibili
image source: here
Feel free to set your own alias
| Cmd | Description |
|---|---|
| man tmux | show tmux documentation |
tmux new -s [Session Name] |
create a new tmux session |
tmux a -t [Session Name] |
attach to an existing session |
| tmux detach | detach current session |
tmux kill-session -t [Session Name] |
Delete a specific Session |
Remember to use these shortcuts inside a tmux session, not normal terminal.
My prefix key is Ctrl-b or C-b, you can map it other keys.
All key remappings and options setting go into ~/.tmux.conf, remember to source this config file every time you make changes.
| Shortcut | Description |
|---|---|
prefix + :list-keys |
See all key binds, and press q to quit |
prefix + :show-options -g |
See all global sessions options, and press q to quit |
prefix + r |
Source the .tmux.conf file |
prefix + $ |
Rename current active session |
prefix + d |
Detach current active session |
prefix + , |
Rename current active window |
prefix + c |
Create new window |
prefix + & |
Kill current window |
prefix + n |
Next window |
prefix + p |
Previous window |
prefix + w |
List all Sessions and windows |
prefix + | |
Split windows left and right |
prefix + - |
Split windows up and down |
Ctrl + h/j/k/l |
Move to the left/down/up/right pane, enabled by vim-tmux-navigator |
prefix + h/j/k/l |
Resize pane, direction keys can be repeated |
prefix + m |
Maximize/Unmaximize current pane |
[ |
Enter copy mode |
Ctrl+c |
Exit copy mode |
To install a plugin, add set -g @plugin [Plugin] in .tmux.conf, don't forget to initialize tpm at the end. Save and quit config file then prefix+I to install the plugins.
- Tmux Plugin Manager: Plugin manager tpm
- Vim-tmux-navigator: Fast navigation among panes and (Neo)Vim
- Tmux-resurrect: Restore tmux env after system restart
- Tmux-continuum: Continuous Saving
- Theme-Pack: Change theme color of Tmux sessions