tmux
tmux new
tmux new-session
tmux new -s $sessionname
tmux a
tmux att
tmux attach
tmux attach-session
tmux a -t $sessionname
tmux kill-sess
tmux kill-session -t $sessionname
Shortcut | Description |
---|---|
Ctrl-b $ |
rename session |
Ctrl-b d |
detach session |
Ctrl-b ) |
next session |
Ctrl-b ( |
previous session |
Windows are like tabs in a browser. Windows exist in sessions and occupy the space of a session screen.
Shortcut | Description |
---|---|
Ctrl-b c |
create window |
Ctrl-b n |
move to next window |
Ctrl-b p |
move to previous window |
Ctrl-b l |
move to last used window |
Ctrl-b 0 ..9 |
select window by number |
Ctrl-b ' |
select window by name |
Ctrl-b . |
change window number |
Ctrl-b , |
rename window |
Ctrl-b f |
search windows |
Ctrl-b & |
kill window |
Panes are sections of windows that have been slit into different screens - just like the panes of a real window.
Shortcut | Description |
---|---|
Ctrl-b % |
vertical split |
Ctrl-b " |
horizontal split |
Ctrl-b up |
move to pane above |
Ctrl-b down |
move to pane below |
Ctrl-b left |
move to pane to the left |
Ctrl-b right |
move to pane to the right |
Ctrl-b o |
move to next pane |
Ctrl-b ; |
move to last active pane |
Ctrl-b { |
swap pane with the previous one |
Ctrl-b } |
swap pane with the next one |
Ctrl-b Alt-up |
adjust pane size upwards* |
Ctrl-b Alt-down |
adjust pane size downwards* |
Ctrl-b Alt-left |
adjust pane size to the left* |
Ctrl-b Alt-right |
adjust pane size to the right* |
Ctrl-b z |
zoom into pane |
Ctrl-b ! |
convert pane to window |
Ctrl-b x |
kill pane |
* While holding down Alt
multiple resize commands can be issued (e.g. Ctrl-b
Alt-down-down-right
).
Shortcut | Description |
---|---|
Ctrl-b [ |
enter copy mode |
Ctrl-b ] |
paste from buffer |
Note: These assume mode-keys vi
(see configuration below).
Shortcut | Description |
---|---|
space |
start selection |
enter |
copy selection |
escape |
clear selection |
g |
go to top |
G |
go to bottom |
h |
move cursor left |
j |
move cursor down |
k |
move cursor up |
l |
move cursor right |
/ |
search |
# |
list paste buffers |
q |
quit |
The global configuration file lives in /etc/tmux.conf
. User-specific configuration files (potentially overriding values from the global configuration) can be created under ~/.tmux.conf
${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf
(usually ~/.config/tmux/tmux.conf
).
Note: In order for tmux-256color
to work properly, a package containing the appropriate terminfo
must be installed. On Debian 9 this is ncurses-term
. On Debian 10 tmux-256color
was
moved from ncurses-term
to ncurses-base
, making installation of ncurses-term
unnecessary.
Alternatively the value of default-terminal
can be changed to screen-256color
(screen terminfo
is already part of ncurses-base
).
# Apply nicer colors
set -g status-style fg=black,bg=cyan
set -g window-status-current-style fg=cyan,bg=black
set -g message-style fg=white,bg=black,bright
# Or for tmux < 3.0
#set -g status-bg cyan
#set -g status-fg black
#set -g window-status-current-bg black
#set -g window-status-current-fg cyan
#set -g message-bg black
#set -g message-fg white
#set -g message-attr bright
# Enable mouse support
set -g mouse on
# Set 256 color terminal type
set -g default-terminal tmux-256color
#set -g default-command zsh
# Use Vim-style shortcuts in copy mode
set -g mode-keys vi
# Remove the delay when pressing escape. This is annoying when using vim.
set -sg escape-time 10