tmux Quickstart
There are a couple of great tmux resources out there, like tmuxcheatsheet, and a lot of resources that are covered in AI generated ads for wrinkle cream. I think the best way to present this information is to start with the very minimum, and then build up.
Custom Config
This is my tmux config that I got from somewhere a couple of years ago. The
default way to use tmux commands is to use the key combination CTRL-b, but I
find CTRL-SPACE more ergonomic on my keyboard, so I configured that here.
set -g mouse on
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g default-terminal "screen-256color"
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'Sessions
The main idea is that you have on-going sessions. Then each session can have one or more windows, and each window can have one or more panes.
See all sessions like this,
tmux lsCreate a new (named) session from the terminal, outside of tmux,
tmux new
tmux new -s <session-name>From inside tmux, you can create a (named) session as,
CTRL-SPACE : new
CTRL-SPACE : new -s <session-name>Detach from a session like this,
CTRL-SPACE dThen re-attach to a session like this,
tmux a -t <session-name>If you’re in a session, and you want to switch to another session, then you can bring up a list of sessions with,
CTRL-SPACE sAnd then navigate via mouse, or hit a number, and RETURN to go to that session.
Panes
Panes are created in Windows. Using the config above, you can split a window into side-by-side panes as,
CTRL-SPACE |And into panes above and below as,
CTRL-SPACE -And then you can navigate between panes by using CTRL-SPACE <arrow>.
Kill a pane using,
CTRL-SPACE xThis will come up with a y/n prompt to confirm.
Windows
If panes are not enough in your session, and you need to add another window, then you can add one like this,
CTRL-SPACE cAnd you can rename the window with,
CTRL-SPACE ,You cycle to the previous and next windows with,
CTRL-SPACE p
CTRL-SPACE nYou can name a window, and list all windows, with,
CTRL-SPACE ,
CTRL-SPACE wWhen you list all of the windows, you can open any one of them by using your arrow key and hitting return. You can also switch to a window directly by number,
CTRL-SPACE b <number>Finally, you can close the current window by using,
CTRL-SPACE b &