tmux beginners guide

Posted: November 15, 2022 at 12:00 PM

Originally Posted: Sun Aug 07 18:40:30 +0000 2022

First, here’s the .tmux.conf I use (alt text to copy/paste).

This remaps the control key from ctrl-b (^B) to ctrl-a which is more natural for me.

Next is split windows, to have two windows side by side: ^A %, to have top/bottom: ^A “.

unbind C-b set -g prefix C-a bind C-a send-prefix  bind ^L refresh-client set-window-option -g mode-keys vi  bind < resize-pane -L 4 bind > resize-pane -R 4 bind - resize-pane -D 4 bind + resize-pane -U 4  set -g mode-mouse off set -g mouse-resize-pane off set -g mouse-select-pane off set -g mouse-select-window off  bind k select-pane -U bind j select-pane -D bind h select-pane -L bind l select-pane -R

To move between windows, ^A then one of h (up) j (left) k (right) l (ell down), aka the vi movement keys, or you can use arrow keys.

To resize the current window, ^A < or > or + or -.

To swap two windows (to move them around), ^A { or ^A }.

To copy between windows, ^A [. Then move the cursor to where you want to start, hit space to start selection, move to the end, hit enter. Now that you have your selection, to paste it, ^A ].

To create another workspace in the same session ^A c. To switch workspaces, ^A num.

Note that my window/workspace terminology doesn’t line up w/ tmux’s, but makes more sense to me.

fin.

Oh, another thing. You have have multiple terminals connected to the same session (tmux attach). This is great for pair programming, so you both don’t have to crowd around a terminal and swap keyboards, each can be on their own laptop, or now w/ WFH, be far away.

| Home |