Tmux reference
27 February 2024 (Updated 30 September 2024)
Install
brew install tmux
Bindings + commands
Command | Description |
tmux ls | List session |
tmux detach | Detach from current session |
tmux attach | Attach to the latest session |
tmux attach -t <session> | Attach to a particular session |
tmux kill-server | Kill all session |
tmux kill-session -t <session> | Kill a specific session |
tmux kill-session -a | Kill all other sessions (excluding the active session) |
<prefix>, $ | Rename current-session |
<prefix>, : and then type `select-pane -T <pane-name> | Rename page |
<prefix>, : and then type splitw -fv | Add horizontal pane that spans full window with |
- Prefix +
:
- Open prompt
prefix + z
- Toggle zoom
tmux detach
- Detach from session
tmux attach
tmux attach -t <name>
Configure
Create a ~/.tmux.conf
and tmux should pick up your config automatically.
Create Bash /ZSH aliases
# Tmux
alias t="tmux"
alias tl="tmux ls"
alias tx="tmux kill-server"
Configure VIM-like keybindings:
# Remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Split window horizontally
bind-key n split-window -h
# Split window vertically
bind-key v split-window -v
# Bind keys for moving panes
bind-key k select-pane -U
bind-key l select-pane -R
bind-key j select-pane -D
bind-key h select-pane -L
# Bind key for closing pane
bind-key q kill-pane
# Enable mouse control (clickable windows, panes, resizable panes)
set -g mouse on
Sources/links
Tagged:
Misc
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment