KAEDE Hack blog

JavaScript 中心に ライブラリなどの使い方を解説する技術ブログ。

Tmux Cheat Sheet

tmux cheatsheet

what is tmux?

  • A virtual terminal open in terminal.
  • I am using this in MacOS, Ubuntu, Win(WSL).
  • It can make virtual windows, and name them.
  • Also the char color updated much lighter in WSL.
  • It is consisted of [session, window, pane]

qiita.com

www.task-notes.com

session

Session contains window(like chrome tab).

starts(attach) session

tmux: starts new tmux session.
tmux a: starts tmux with last session.

back to terminal

prefix + d: Get back your normal terminal.
* session is saved.

LIST

tmuxcheatsheet.com

gist.github.com

tmux ls: list up tmux sessions

kaedes-MBP:~ kaede$ tmux ls
0: 1 windows (created Sun Sep 15 23:06:27 2019)
1: 4 windows (created Sun Sep 15 23:15:23 2019)
2: 5 windows (created Mon Sep 23 19:49:08 2019)
6: 2 windows (created Fri Sep 27 15:20:48 2019) (attached)

or
* prefix-s

(0)  + 0: 1 windows
(1)  + 1: 4 windows
(2)  + 2: 5 windows
(3)  + 6: 2 windows (attached)

CHANGE

prefix -(: move to next session.
prefix -): move to prev session.

RENAME

prefix + d

KILL ALL

  • ending every tab by exit tmux kill-server

Window

prefix + c
* make new window. prefix + n * move to the next window. prefix + , * rename window prefix + &,exit * can close window. * closing last window ends the session. :exit` can close the window

All can be edit by tmux.conf file.
I am using prefix-(h,j,k,l) moving now.

pain

tmuxcheatsheet.com

Pane is inside of window.

DIVIDE

prefix %: Split pane vertically
prefix ": Split pane horizontally

MOVE

CLOSE

.tmux.conf

tmux can change prefix and short cut by ~.tmux.conf file.

Change Prefix key

set -g prefix C-w
unbind C-b

you can
bind C-a send-prefix

use vim move for pane switching

stackoverflow.com

bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

make ~/.tmux.conf
and write settings

this enable hjkl pane move.