tmux
Installing tmux
| Platform | Install Command |
|---|---|
| Debian or Ubuntu | apt install tmux |
| macOS (using Homebrew) | brew install tmux |
Useful cmd / shortcut
| Cmd | Shortcut | 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 | prefix + d |
Detach current session |
tmux kill-session -t [Session Name] |
Delete a specific Session | |
prefix + r |
Source the .tmux.conf file |
|
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 |
Personal configuration
All key remappings and options setting go into~/.tmux.conf
(Remeber to source the config file after you make changes)
My prefix key is Ctrl-a
1 | |
Plugins
Install tpm
First, we will clone tpm into ~/.tmux folder under the home folder
1 | |
Installing Plugins
- Add new plugin to
~/.tmux.confwithset -g @plugin '...' - Make sure
run -b '~/.tmux/plugins/tpm/tpm'is at the bottom of your .tmux.conf - Press
prefix+ I (capital i, as in Install) to fetch the plugin. (default prefix is ctrl+b)
Uninstalling Plugins
- Remove (or comment out) plugin from the list.
- Press
prefix+ alt + u (lowercase u as in uninstall) to remove the plugin. Or you can manually delete the plugins stored in~/.tmux/plugins/
Theme
A dark theme for Atom, Alfred, Emacs, Highlight.js, Hyper, iTerm, JetBrains, Pygments, Slack, Sublime Text, TextMate, Terminal.app, Vim, Xcode, Zsh, and many more.
Others
Updated my arch linux server and now I get tmux: need UTF-8 locale (LC_CTYPE) but have ANSI_X3.4-1968
The same exact thing happened to me. Building on what Thomas said
above, I was able to fix it by uncommenting
en_US.UTF-8 UTF-8 in my /etc/locale.gen file
(previously none of the lines had been uncommented), then running
locale-gen.
My Configuration
1 | |
Ref
tmux
http://example.com/2023/04/20/tmux/