tmuxコマンド

チートシート

Posted by     "sora" on Wednesday, October 11, 2023

tmuxコマンド チートシート

コマンドでの操作

操作 コマンド
セッション作成 tmux
名前を付けて作成 tmux new -s 名前
セッション一覧 tmux ls
クライアント一覧 tmux lsc
セッション再開 tmux a
セッション再開(指定) tmux a -t 名前
セッション終了 tmux kill-session
セッション終了(指定) tmux kill-session -t 名前
.tmux.confの再読込 tmux source ~/.tmux.conf

プレフィックス(デフォルト Ctrl+b)を使用した操作

基本操作

操作  コマンド 
キーバインド一覧 ?
セッション一覧 s
セッションからデタッチ d
セッション名変更 $
コマンドモードに切り替え :

ウィンドウ操作

操作 コマンド
ウィンドウ作成 c
ウィンドウ一覧 w
ウィンドウ移動 0~9
ウィンドウの破棄 &
次のウインドウへ移動 n
前のウインドウへ移動 p
以前のウインドウへ移動 l
ウィンドウの名前変更 ,

ペイン操作

操作  コマンド 
左右分割 %
上下にペイン分割 "
ペインの破棄 x
ペインを移動 o
最大化/復帰 z

おすすめtmux.conf

  • ~/.tmux.confに設定する
  • tmux source-file ~/.tmux.confで設定保存
# プレフィックスキーをCtrl+qに変更
 unbind C-b
 set -g prefix C-q
 bind C-q send-prefix

# コピーモードの操作をviスタイルにする
 setw -g mode-keys vi

# マウスを使用可能にする
 set -g mouse on

# Shift + カーソルキーでペインのサイズ調整
 bind -n S-Up resize-pane -U 2
 bind -n S-Down resize-pane -D 2
 bind -n S-Left resize-pane -L 2
 bind -n S-Right resize-pane -R 2

# r で設定ファイルをリロードする
 bind r source-file ~/.tmux.conf\; display-message "Reload Config!!"

# 別ウィンドウの動作を通知する
 setw -g monitor-activity on
 set -g visual-activity on