Tmux
Command cheatsheet
Ctrl+b (aka PREFIX) is used to enter in tmux command mode
Do it once then enter the second command (c key to create a new window).
Command | Description |
---|---|
<PREFIX> c | create a new window |
<PREFIX> n | move to the next window. |
<PREFIX> p | move to the previous window. |
<PREFIX> PgUp/PgDown | Scroll mode (q to exit) |
<PREFIX> $ | Rename session |
<PREFIX> , | Rename window |
<PREFIX> " | split pane horizontally. |
<PREFIX> % | split pane vertically. |
<PREFIX> arrow key | switch pane. |
Hold <PREFIX> arrow-keys | resize pane. |
<PREFIX>+d | exit pane |
Copy pane content
# to copy the content of the pane into a new buffer
<PREFIX>:capture-pane -S-
# to save the content of a buffer into a file
<PREFIX>:save-buffer file.log
You can also do the same thing with tmux command, but you have to specify the window and pane name (or index)
tmux capture-pane -t <WINDOW>:<PANE> -pS- > file.log
~/.tmux.conf example
## remap prefix from 'C-b' to 'C-a'
# unbind C-b
# set-option -g prefix C-a
# bind-key C-a send-prefix
## split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
## switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
## switch window using Ctrl-arrow without prefix
bind -n M-PageUp previous-window
bind -n M-PageDown next-window
## Mouse mode
set -g mouse off
set-option -g default-shell /usr/bin/zsh
Last-Updated: