junxnone / linux

Linux wiki
https://junxnone.github.io/linux/
0 stars 0 forks source link

Tools Remote tmux #51

Open junxnone opened 5 years ago

junxnone commented 5 years ago

tmux

Install

Install on Ubuntu

sudo apt install tmux

从源码编译安装

sudo apt install libevent-dev libncurses-dev
wget https://github.com/tmux/tmux/releases/download/3.0/tmux-3.0-rc3.tar.gz
tar zvxf tmux-3.0-rc3.tar.gz
cd tmux-3.0-rc3
./configure && make
sudo make install

Config

设置鼠标

set -g mouse on 

设置了此选项后选择复制时需要同时按住Shift按键

UseCase

Command Line

Target Commands
Set base directory inside tmux: Ctrl - b + : + attach -c the_directory
outside tmux: tmux attach -t session_name -c work_dir
New session tmux new -s xxx
List the Session tmux ls
Open the session tmux at -t xxx
Close the session tmux kill-session -t xxxx
rename the window tmux rename-window new_name

HotKeys

HotKey Description
Ctrl - b + % 垂直分割
Ctrl - b + " 水平分割
Ctrl - b + o 交换窗格
Ctrl - b + x 关闭窗格
Ctrl - b + 空格键 - 切换布局
Ctrl - b + q 显示窗格编号,按相应数字切换窗格
Ctrl - b + { 与上一个窗格交换位置
Ctrl - b + } 与下一个窗格交换位置
Ctrl - b + z 切换窗格最大化/最小化
Ctrl - b + s list the session
Ctrl - b + w list the windows
Ctrl - b + ←↑↓→ 切换 Pane
Ctrl - b + c 当前 Session 创建 新 Windows
Ctrl - b + Shift - d Attach 其他 client
Ctrl - b + ! move pane to new window
Ctrl - b + , rename the window

Issues

窗口显示不全

使用如下快捷键:

Ctrl + b +Shift + d

或者:

tmux attach -d

Reference